The example
The JSON above is the example. Explore it in the Tree tab, press Download to save it as a .json file, or Share to send someone a link to it. All names, ids, emails and values are invented.
Fields explained
| Path | Type | Notes |
|---|---|---|
name | string | Text in double quotes. |
age | number | An integer. JSON does not distinguish integers from decimals. |
isMember | boolean | true or false, written without quotes. |
balance | number | A decimal number. |
nickname | null | An explicit empty value, different from a missing key. |
languages | array of strings | An ordered list in square brackets. |
address | object | A nested set of key and value pairs. |
Read it in code
JavaScript:
const data = JSON.parse(text);
console.log(data.address.city); // "London"Python:
import json
data = json.loads(text)
print(data["address"]["city"]) # LondonWhat this example is good for
- Learning JSON syntax
- A first input for formatters, validators and converters
- Checking that a parser handles every value type
Tips
- Keys are always strings in double quotes.
- There is no comma after the last item of an object or array.
Convert this example
Open it in a converter, then switch the output in the Code tab:
- JSON to TypeScript
- JSON to Zod
- JSON to Python (Pydantic)
- JSON to Go
- JSON to JSON Schema
- JSON to CSV
- JSON to YAML
- JSON to XML