JSON
As you have been using JavaScript up until now in this book, you should feel right at home with the syntax of JSON, as it is derived from JavaScript and closely resembles object structures you have already learned in previous chapters. JSON, usually pronounced like the name Jason, is lightweight, easy for humans to read and write, and easy for machines to parse and work with.
There are two main data structures used in JSON:
- A collection of key-value pairs enclosed in curly-braces
{ }
- A list of values enclosed in square brackets
[ ]
Here's a sample JSON object that shows different structures and value types:
sample_json.json
1 { 2 "twitter_username": "@LeoDiCaprio", 3 "first_name": "Leonardo", 4 "last_name": "DiCaprio", 5 "famous_movies": [{ 6 ...