我首先要说我对 JSON 不是很熟悉。
我正在创建一个 Web 服务,它将接受来自 iOS 设备的 JSON 数据,并获取该数据并将其插入到数据库中。
我遇到的麻烦是图像字节数据是巨大的。这会导致服务器端错误“表达式太长或太复杂而无法编译”。
这是 JSON 数据和 JavaScript AJAX 调用:
var source = {
"longitude": 96.84610000000001,
"latitude": 35.5608,
"username": "blah",
"imageDataBlob": "\/9j\/4UI5RXhpZgAASUkqAAgAAAAKAA8BAgASAAAAhgAAABABAgALAAAAmAAA\nABoBBQABAAAApAAAABsBBQABAAAArAAAACgBAwABAAAAAgAAADEBAgAJAAAA\ntAAAADIBAgAUAAAAvgAAADsBAgAPAAAA0gAAAJiCAgAdAAAA4gAAAGmHBAAB\nAAAAAAEAAAgDAABOSUtPTiBDT1JQT1JBVElPTgBOSUtPTiBENzAwAAD6AAAA\nAQAAAPoAAAABAAAAVmVyLjEuMDEAADIwMTA6MDc6MTQgMDM6MzE6NTEATmFz\naW0gTWFuc3Vyb3YAAENvcHlyaWdodCAoQykgTmFzaW0gTWFuc3Vyb3YAACAA\nmoIFAAEAAACGAgAAnYIFAAEAAACOAgAAIogDAAEAAAADAAAAJ4gDAAEAAADI\nAAAAAJAHAAQAAAAwMjIxA5ACABQAAACWAgAABJACABQAAACqAgAAAZIKAAEA\nAAC+AgAAApIFAAEAAADGAgAABJIKAAEAAADOAgAABZIFAAEAAADWAgAAB5ID\nAAEAAAAFAAAACJIDAAEAAAAAAAAACZIDAAEAAAAAAAAACpIFAAEAAADeAgAA\nhpIHABoAAADmAgAAkZICAAMAAAA3NAAAkpICAAMAAAA3NAAAF6IDAAEAAAAC\nAAAAAKMHAAEAAAADAAAAAaMHAAEAAAABAAAAAaQDAAEAAAAAAAAAAqQDAAEA\nAAAAAAAAA6QDAAEAAAAAAAAABKQFAAEAAAAAAwAABaQDAAEAAAA...etc"
}
$.ajax({
type: "POST",
dataType: "json",
url: "/api/blah/PostPicture/",
data: source
});
如果我需要处理传递给我的 Web 服务的 JSON 数据,我该如何处理如此庞大的 JSON 对象?我可以在 web.config 中修改任何配置设置以允许这样做吗?