ios - JSON Parsing Returns Null For Large Values Only -
i'll keep brief. i'm using code parse json local file array of objects:
-(void)populatedata { nsstring* sourcepath = [[nsbundle mainbundle]pathforresource:@"ships" oftype:@"json"]; //get json string nsstring* jsondata = [[nsstring alloc] initwithcontentsoffile:sourcepath encoding:nsutf8stringencoding error:nil]; nsdata* data = [jsondata datausingencoding:nsutf8stringencoding]; //put json in array ships = [nsjsonserialization jsonobjectwithdata:data options:nsjsonreadingmutablecontainers error:nil]; nslog(@"%@", ships); }
(note: showed 1 sake of brevity, there's ~20 entries in each one)
this method works json formatted this:
[ { "name": "santa maria", "operator": "kingdom of spain", "flag": "flag_spain" } ]
it returns null json formatted this:
[ { "name": "santa maria", "operator": "kingdom of spain", "flag": "flag_spain", "launched": "november 19, 1890", "fate": "destroyed in havana, cuba in feburary 1898." "cost":"$4,677,788.75", "image": "maine_img", "image_attribution": "image in public domain." }]
i haven't faintest idea of why smaller 1 works while larger 1 doesn't. appreciated.
there comma missing after:
"fate": "destroyed in havana, cuba in feburary 1898."
Comments
Post a Comment