In iOS, how do I parse a JSON string into an object

前端 未结 7 833
日久生厌
日久生厌 2021-02-08 05:41

I come from Android dev, so sorry if I\'m missing obvious iOS concepts here.

I have a JSON feed that looks like:

{\"directory\":[{\"id\":0,\"fName\":\"...\

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-08 06:12

    Use following code:

    NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
    

    This will covert json data onto NSDictionary, which is similar to hashmap on android. I think this will help you. :)

提交回复
热议问题