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 |
|---|---|---|
id | number | A numeric identifier. Very large ids should be sent as strings. |
email | string | example.com is reserved for documentation, so it never belongs to a real person. |
profile.bio | null | A field that exists but has no value yet. |
roles | array of strings | Permissions as a list of names. |
preferences.notifications | object | Grouped boolean settings. |
createdAt | string | ISO 8601 UTC timestamp. JSON has no date type, so dates are strings. |
Read it in code
JavaScript:
const user = await (await fetch("/api/users/1042")).json();
if (user.preferences.notifications.email) sendDigest(user.email);Python:
user = requests.get(url).json()
if user["preferences"]["notifications"]["email"]:
send_digest(user["email"])What this example is good for
- Mocking a users API in tests and documentation
- Generating TypeScript, Zod or Python models from a realistic response
- Trying the JSON Schema validator with required fields
Tips
- Use ISO 8601 for dates and convert in your code.
- Prefer null for a known but empty value and omit keys that do not apply.
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