JSON Data Examples
Here is a collection of common JSON structures used in development. You can copy these codes directly into the JSON Formatter for testing, validation, or minification.
1. Standard API Response (RESTful)
{
"code": 200,
"message": "success",
"timestamp": 1678892400,
"data": {
"user_id": 10086,
"username": "developer_01",
"roles": ["admin", "editor"],
"profile": {
"email": "dev@example.com",
"verified": true
}
}
}
The most common backend interface return format, containing status code, message, and nested data objects.
2. Complex Nested Array (E-commerce)
{
"total": 2,
"page": 1,
"limit": 20,
"products": [
{
"id": 101,
"name": "Wireless Noise Cancelling Headphones",
"price": 199.99,
"stock": 50,
"tags": ["electronics", "audio", "wireless"],
"specs": {
"color": "black",
"weight": "250g",
"battery": "30h"
}
},
{
"id": 102,
"name": "Mechanical Keyboard",
"price": 89.00,
"stock": 0,
"tags": ["electronics", "accessories"],
"specs": {
"switch": "cherry-red",
"layout": "87-key"
}
}
]
}
3. Configuration File (VS Code settings.json)
{
"editor.fontSize": 14,
"editor.tabSize": 2,
"editor.formatOnSave": true,
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true,
"**/node_modules": true
},
"workbench.colorTheme": "One Dark Pro",
"git.autofetch": true
}
Why JSON?
JSON (JavaScript Object Notation) is a lightweight data interchange format. It is easy for humans to read and write, and easy for machines to parse and generate. Compared to XML, JSON is smaller, faster, and easier to parse, making it the standard data format for modern Web APIs.