Network data parsing for iOS development (1) -- Introduction to JSON parsing, and ios -- json
Data returned to the client after a server request is generally in JSON or XML format (except for file downloads)
This article explains JSON parsing at will.
Body:
About JSON:
Supplement:
Note: The key must use double quotation marks. (But it is a single quotation mark in Java)
Conversion table of JSON-OC
Where: null -- return the NSNull type in OC
Usage:
There are many JSON resolution solutions, but (Apple's native) NSJSONSerialization has the best performance
Deserialization (JSON --> OC object), the following example is resolved to a dictionary object
Serialization (OC object --> JSON). Note that the dictionary value cannot be passed to nil, but [NSNull null]
Not all types can be converted to JSON.
The following are Apple's official regulations: