Working with JSON
As discussed in the last recipe, almost every app will need to exchange information with the internet at some point, and in that recipe, we retrieved an image from a remote server. Very often, your app will need to retrieve more varied data, perhaps relating to the result of a search, or information about a shared state held on the server.
This information can be represented in any number of ways, but one of the most common ways is as JavaScript Object Notation (JSON), which is a text-based structure for representing information. A JSON object contains key-value pairs, where the keys are strings and the values can be strings, numbers, Booleans, null, other objects, or arrays.
For example, information about a person could be expressed with this JSON object:
{ "name": { "givenName": "Keith", ...