JSON文件问题

时间:2015-10-10 22:20:32

标签: objective-c json serialization

所以,我正在制作一个城市规划应用程序,并开始使用JSON练习我已经制作了一个简单的文件,其中包含城市名称,三个最高的建筑物和人口...这里是什么我的JSON文件看起来像......

[{ "city" : "New York", "Buildings" : [ One World Trade Center, 432     Park Avenue, Empire State Building ], "pop" : 21,000,000 },
[{ "city" : "Chicago", "Buildings" : [ Sears Tower, Trump Tower, AON     Center ], "pop" : 9,000,000 },
[{ "city" : "Philadelphia", "Buildings" : [ Comcast Center, One Liberty     Place, Two Liberty Place ], "pop" : 6,000,000 }]

使用表视图和序列化代码正确设置了所有内容,但我不断收到错误

Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be     completed. (Cocoa error 3840.)" (Invalid value around character 40.) 

非常感谢任何帮助。谢谢!

1 个答案:

答案 0 :(得分:1)

您可能希望显示您的代码,但它可能无关紧要,因为您的数据格式不正确JSON,这可能是此处的实际问题。首先,你的一些字符串没有被引用。另一方面,你有更多的东西。