Great! An example JSON file looks like this:
{
"first_name": "Guido",
"last_name": "van Rossum",
"titles": ["BDFL", "Developer"],
"age": 63,
"married": true
}
The file contains a collection of name-value pairs, separated by a comma.
The first pair is "first_name": "Guido"
. In this pair, first_name
is the name and Guido
is the value. After a comma, we have the next name-value pair, and so on.
Look at the third pair: "titles": ["BDFL", "Developer"]
. This is also a name-value pair: titles
is the name and the array ["BDFL", "Developer"]
is the value. This is a key difference between the JSON and CSV formats: CSV is a flat format; it does not support nested objects.
Notice that in JSON, all the field names (e.g., first_name
) are in double quotes ("
).