我有以下格式的JSON字符串,需要在objective-c
中解析[{"image":"<link_to_image>",
"pic-number":"2862",
"n-lines":5,
"default":"[{"line_1":"one!"},
{"line_2":"two"},
{"line_3":"three"},
{"line_4":"four"},
{"line_5":"five"}]"
},
... ]
默认数组的长度可能因每个项目而异。
答案 0 :(得分:2)
尝试使用TouchJSON
:
http://code.google.com/p/touchcode/
并且还要经历这些
How to use touch json and sbjson
答案 1 :(得分:1)
刚刚找到问题的原因,
相反
"default":**"**[{"line_1":"one!"},
{"line_2":"two"},
{"line_3":"three"},
{"line_4":"four"},
{"line_5":"five"}]**"**
JSON字符串应具有以下格式,否则解析将失败
"default":[{"line_1":"one!"},
{"line_2":"two"},
{"line_3":"three"},
{"line_4":"four"},
{"line_5":"five"}]