Foreword: After the server request, the data returned to the client is usually in JSON format or XML format (except for file download)
This article is just about JSON parsing.
Text:
About JSON:
- JSON is a lightweight data format that is typically used for data interaction
- The JSON format is much like the dictionary and array in objective-c: {"name": "Jack", "Age": 10}
Add:
Note points in the standard JSON format: Key must be in double quotation marks. (but single quotes in Java)
Conversion table for JSON-OC
Where: null--returns the type of Nsnull in OC
Use:
There are many kinds of JSON parsing schemes, but the nsjsonserialization performance is the best (Apple native)
Deserialization (JSON-to-OC object), the following example resolves to a Dictionary object
Serialization (OC Object-to-JSON), note that the value of the dictionary cannot be nil, but can be passed [NSNull NULL]
Not all types can be converted to JSON.
The following are Apple's official Rules:
Analysis of network data for iOS development (i) Introduction to--json parsing