Note that there are some explanatory texts on larger screens.

plurals
  1. POJson parsing wrong in IOS
    primarykey
    data
    text
    <p>Hi i have some problem parsing the json in IOS. This is the json data. </p> <pre><code>{ "app_info": [ { "app_name": "haka", "sync_protocol_version": "1" } ], "updates": [ { "timestamp": "Sat Apr 21 13:04:08 IST 2012", "people": [ { "personal_info": [ { "first_name": "phlox", "last_name": "", "employee_id": "010", "gender": "-", "marital_status": "-", "nationality": "Denobulan", "dob": "re-23", "photo": "http://c.cc/users/010/profile/image" } ], "contact_details": [ { "address": [ { "street": "#1, this way", "city": "tank", "state": "sick bay", "zip": "0978", "country": "Enterprise" } ], "telephone": [ { "work": "010", "mobile": "010", "home": "010" } ], "email": [ { "work": "phlox@nx-10.ent", "personal": "" } ] } ], "emergency": [ { "contact": [ { "name": "-", "relationship": "", "telephone": [ { "work": "", "home": "", "mobile": "" } ] } ], "blood_group": "" } ], "categorization": [ { "designation": "", "department": "", "location": "", "joining_date": "" } ] }, { "personal_info": [ { "first_name": "", "last_name": "", "employee_id": "", "gender": "", "marital_status": "", "nationality": "", "dob": "", "photo": "" } ], "contact_details": [ { "address": [ { "street": "", "city": "", "state": "", "zip": "", "country": "" } ], "telephone": [ { "work": "", "mobile": "", "home": "" } ], "email": [ { "work": "", "personal": "" } ] } ], "emergency": [ { "contact": [ { "name": "", "relationship": "", "telephone": [ { "work": "", "home": "", "mobile": "" } ] } ], "blood_group": "" } ], "categorization": [ { "designation": "", "department": "", "location": "", "joining_date": "" } ] } ], "messages": [ { "sender": "Archer&lt;admin@nx-10.ent&gt;", "sender_role": "admin", "message_type": "broadcast", "message": "parking space up for grabs", "message_recipients": "all", "reply_permitted": "0" } ], "events": [ { "creator": "Travis&lt;ensign@nx-01.ent&gt;", "event_title": "", "event_description": "", "event_time_start": "", "event_time_end": "", "location": "", "invitees": [ { "id": "020", "acceptance": "1" } ] } ], "settings": [ { "sync_frequency": "0" } ] } ]} </code></pre> <p>This is a valid json format. I have checked it with <a href="http://jsonlint.com/" rel="nofollow">http://jsonlint.com/</a> and using <a href="http://braincast.nl/samples/jsoneditor/" rel="nofollow">http://braincast.nl/samples/jsoneditor/</a></p> <p>see the structure of json value.According to structure the people tag should return count of 2, as it has 2 objects, but it is returning only 1 while parsing. I am completely out of options. Please help guys.</p> <p>This is the code i am using for parsing</p> <pre><code>NSString *textPAth = [[NSBundle mainBundle] pathForResource:@"sync" ofType:@"json"]; NSError *error; NSString *content = [NSString stringWithContentsOfFile:textPAth encoding:NSUTF8StringEncoding error:&amp;error]; NSArray *jsonArray = [[content JSONValue] retain]; NSLog(@"JSON ARRAY %@ AND COUNT %d",[[jsonArray valueForKey:@"updates"] valueForKey:@"people"],[[[jsonArray valueForKey:@"updates"] valueForKey:@"people"] count]); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload