ios - Objective-c parsing JSON -


I'm totally new in Objective-c programming.

I try to get a request for my app I am using OpenC for Unirest as HTTP libraries.

My API will return JSON as below: -

  {"merchant_list": [{"_id": "543ce2887ca4e102af44a5a8", "address": "MyAddress Null, "dollar_ratio": Null, "American Plan": Null, "Logo": Null, "min_spending_VIP": "Bla bla bla", "administrator": ["543ce2887ca4e102af44a5a7"], "card" "Proposal": [], "referral_ratio": null}], "status": "ok"} , "modification_timestamp_utc": 1413276296.0, "name": "Lorem ipsum", "outlet" Code>  

Unirest library as you see body.JSONObject [@ NSDictionary or NSArray can pars this JSON "status"] Give me Area "right" price.

But the problem is, I'm unable to use all the features in merchant_list.

  UNIJsonNode * body = response.body; If ([body.JSONObject [@ "status"] is extolstration: @ "OK"]) {NSLog (@ "% @", body.JSONObject [@ "Merchant_list"]); }  

The NSLog value of merchant_list below: -

  2014-10-17 18: 07: 10.623 mapp [18567: 287513] ({"_id" = 543ce2887ca4e102af44a5a8; Address = "MyAddress bla bla bla"; Admin = (543ce2887ca4e102af44a5a7); Card = "& lt; null & gt;"; cycle = "& lt; null & gt;", "dollar_ratio" = "& lt; Null & gt; FB = "& lt; null & gt;"; logo = "& lt; null & gt;", "min_spending_VIP" = "& lt; null & gt;", "modification_timestamp_utc" = 1413276296, Name = "Lorem ipsum", stores = (); Promotion = (); "Referral_ratio" = ""}}  

Any help? I have already spent hours for this error.

Today I have a bad fever but I am still working. As a result I can not even solve this simple mistake.

Thank you for Rajpal Thakur for highlighting this issue.

Now I can use these attributes: -

  if ([body.JSONObject [@ "status"] isEqualToString: @ "OK"]) { For (ID dealer in body.JSONObject [@ "merchant_list"]) {{ID in Merchant Key} {@ NSLog (for @ "Key:% @, Price:% @ \ n", Key, [Merchant ObjectForca: Key ]); }}}  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -