Introducing JSON
In this section, we'll do a quick introduction to JSON. JSON is a popular data-interchange format that is lightweight, easy for machines to parse, and easy for humans to read.
The JSON syntax is based on a subset of the JavaScript programming language and it defines two data structures:
- A collection of name/value pairs
- An ordered list of values
These two data structures are supported in one way or another by virtually all modern programming languages. So, although the JSON syntax is based on a subset of JavaScript, it can be easily used with other languages as well.
The two data structures in JSON are defined as either an object or an array. An object begins with a left brace and ends with a right brace. An empty object would look like the following example:
{}
An object can contain a set of name/value pairs, referred to as elements. Elements in an object don't need to be in any particular order and the value can...