Analysis of network data of iOS development (I.) Introduction to--json Analysis

Source: Internet
Author: User

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:

    1. JSON is a lightweight data format that is typically used for data interaction
    2. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.