1

i already found a way to convert a json string like {"a":"b"} to an nsdictionary in IOS. How do i convert a JSON String to a dictionary in IOS5

But is there a way to convert something like that "[{"a":"b"},{"a":"b"},{"a":"b"}]" to an nsarray with nsdictionaries?

I need that for my API but still found no solution.

Hope someone can help me! Thanks

Jonny

Community
  • 1
  • 1
JIM
  • 500
  • 4
  • 11
  • Just a guess: Use a JSON parser such as NSJSONSerialization. (Or any of the other half-dozen JSON parsers for Objective-C listed at json.org.) – Hot Licks Jun 28 '14 at 16:10

1 Answers1

1

It is exactly the same API. -JSONObjectWithData:options:error: will return an NSArray if the top-level item in your JSON is an array.

Jesse Rusak
  • 56,530
  • 12
  • 101
  • 102
  • yes i just had to define my variable as an NSArray instead of NSDictionary... stupid... – JIM Jun 28 '14 at 16:42