Parse JSON array

女生的网名这么多〃 提交于 2019-12-01 13:07:28

问题


I fetch a JSON array from a web service with touchJSON. Which looks like this:

[{"icecream": {"title": "Banana"}}, {"icecream": {"title": "Strawberry"}}]

I'm not able to parse this into a NSDictionary, because touchJSON doesn't support JSON arrays.

How do I get my JSON array into a NSDicitionary?

Regards


回答1:


Have you consider trying another framework? This one seems to support JSON arrays.




回答2:


Maybe you could use another of the many JSON implementations listed on the JSON homepage.




回答3:


You can chekc out the JSON webpage, where they provide links to parsing code in dozens of languages. However, at first glance it looks like you're trying to munge from one type of object (the JSON Array) into another that might not be able to capture all the relationships (the NSDictionary). Full disclaimer: I've never used an NSDictionary before.



来源:https://stackoverflow.com/questions/854028/parse-json-array

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!