JSON Data

JSON data, especially when it is condensed like it is in your console, may seem daunting. However, it is actually a very simple syntax. JSON can contain the most basic types used to represent model objects: arrays, dictionaries, strings, numbers, Booleans, and null (nil). JSON dictionaries must have keys that are strings, but the values can be any other JSON type. Finally, arrays can contain any JSON type. Thus, a JSON document is a nested set of these types of values.

Here is an example of some really simple JSON:

    {
        "name" : "Christian",
        "friends" : ["Stacy", "Mikey"],
        "job" : {
            "company" : "Big Nerd Ranch",
            "title" : "Senior Nerd"
        }
    }

This JSON document begins and ends with curly braces ({ and }), which in JSON ...

Get iOS Programming: The Big Nerd Ranch Guide, 7th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.