I feel JSON parsing, and what's important is the processing of the results after JSON parsing
JSON is parsed as a dictionary, but it is possible to include dictionaries and arrays in the dictionary, which can also contain dictionaries.
Parsing of returned data requested by the client
The following is a brief introduction to the JSON parsing process
Actually, just a word.
"Data is the parsing"!!!!!!!!!!!!!!
Xcode comes with parsing class nsjsonserialization from data to the dictionary
Nsdictionary *weatherdic = [nsjsonserialization jsonobjectwithdata:data options:nsjsonreadingmutableleaves Error: &error];
This is a common JSON parsing method, which is simpler and quicker than the following parsing methods.
//touchjson
//The parsed contents are stored in the dictionary
nsdictionary *prootdic = [[Cjsondeserializer deserializer]deserialize:data error:&error];
//The Parse object here is NSData type
//sbjson
//Get a Parser object
Sbjsonparser *parser = [[Sbjsonparser alloc] Init]autorelease];
//Get the dictionary returned after JSON string parsing
nsdictionary *rootdic = [parser objectwithstring:string error:&error];
It is important to note that the parsed data is decoded to the NSString type before you can parse the
//jsonkit
//Get the parsed dictionary (complete resolution, return value is dictionary type)
Nsdictionary * Pweatherdic = [JSONSTR objectfromjsonstringwithparseoptions:jkparseoptionlooseunicode];//Unified Coding Standard
//Note Jsonstr or the data first decoded to the NSString type, and then jsonstr directly with the parse method on the line
//Here is a method to convert data to NSString type
NSString *string = [[ NSString Alloc]initwithdata:data encoding:nsutf8stringencoding];