I hope to decode the JSON data below:
{
"content":
[
{
"1":"a",
"2":"b",
"3":"c",
"4":"d",
"mark":"yes"
}
]
}
Not sure if put it in NSArray or NSDictionary
Welcome any comment
which iOS version are you using? in iOS 5 you have the
NSJSONSerializationclass to parse JSON data, if you need to target older iOSs or MAC OSX you should use third parties lib such asSBJSON. The string posted will be a NSDictionary with an array with one dictionary. The array will be accessible using the key@"content"In code:
In SWIFT 2.0:
[UPDATE]
The
NSJSONSerializationclass is also available for 10.7 my comment wasn’t correct.