Parse JSON array

4.8k views Asked by At

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

3

There are 3 answers

0
pgb On BEST ANSWER

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

0
lothar On

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

1
Ben Mathes On

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.