JSON Examples
Copy-ready valid JSON examples for every use case — from simple objects to nested API responses, config files, and GeoJSON. Click any example to copy, then paste into the JSON validator or JSON formatter.
Simple JSON Object
A basic JSON object with string, number, boolean, and null values.
{
"name": "Alice Johnson",
"age": 28,
"isActive": true,
"score": 98.5,
"department": null
}JSON Array
A JSON array of strings. Arrays hold ordered, comma-separated values inside [ ].
[ "JavaScript", "TypeScript", "Python", "Go", "Rust" ]
Nested JSON Object
JSON objects can contain other objects. This is the most common structure in real-world API responses.
{
"user": {
"id": 12345,
"name": "Alice Johnson",
"address": {
"street": "123 Main St",
"city": "San Francisco",
"state": "CA",
"zip": "94105"
}
}
}Array of Objects
The most common JSON structure for list data — an array where each element is an object.
{
"users": [
{
"id": 1,
"name": "Alice",
"role": "admin"
},
{
"id": 2,
"name": "Bob",
"role": "editor"
},
{
"id": 3,
"name": "Carol",
"role": "viewer"
}
],
"total": 3
}REST API Response
A typical paginated REST API response with metadata, data array, and status fields.
{
"status": "success",
"code": 200,
"page": 1,
"perPage": 20,
"totalItems": 142,
"totalPages": 8,
"data": [
{
"id": "prod_001",
"name": "Wireless Keyboard",
"price": 79.99,
"inStock": true,
"tags": ["electronics", "peripherals"]
},
{
"id": "prod_002",
"name": "USB-C Hub",
"price": 49.99,
"inStock": false,
"tags": ["electronics", "accessories"]
}
]
}Application Config (package.json style)
JSON is the standard format for config files. This example mirrors a typical package.json structure.
{
"name": "my-app",
"version": "2.1.0",
"description": "A modern web application",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"test": "jest --coverage"
},
"dependencies": {
"next": "^15.0.0",
"react": "^19.0.0"
},
"devDependencies": {
"typescript": "^5.0.0",
"jest": "^29.0.0"
},
"engines": {
"node": ">=20.0.0"
}
}All JSON Data Types
JSON supports exactly six data types: string, number, object, array, boolean, and null.
{
"string": "Hello, world!",
"integer": 42,
"float": 3.14159,
"negative": -17,
"boolean_true": true,
"boolean_false": false,
"null_value": null,
"array": [1, 2, 3],
"object": {
"key": "value"
}
}API Error Response
Standard error response structure used by most REST APIs to communicate failures.
{
"status": "error",
"code": 422,
"message": "Validation failed",
"errors": [
{
"field": "email",
"code": "INVALID_FORMAT",
"message": "Must be a valid email address"
},
{
"field": "age",
"code": "OUT_OF_RANGE",
"message": "Must be between 18 and 120"
}
],
"requestId": "req_8f3k2j9x"
}GeoJSON Feature
GeoJSON is a JSON-based format for encoding geographic data structures.
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-122.4194, 37.7749]
},
"properties": {
"name": "San Francisco",
"country": "US",
"population": 873965,
"timezone": "America/Los_Angeles"
}
}JWT Payload (Decoded)
The decoded payload section of a JSON Web Token. JWTs use Base64-encoded JSON for their claims.
{
"sub": "user_12345",
"name": "Alice Johnson",
"email": "alice@example.com",
"roles": ["admin", "editor"],
"iat": 1714500000,
"exp": 1714586400,
"iss": "https://auth.example.com",
"aud": "https://api.example.com"
}Part of the JSON Toolkit
Explore All JSON Tools
Free online tools for every JSON task — format, validate, convert, compare, and more.