JSON Structure Explained
Master JSON syntax, data types, and structural patterns
What is JSON?
JSON (JavaScript Object Notation) is a lightweight, text-based data format designed for data interchange between systems. Created by Douglas Crockford in the early 2000s, JSON has become the de facto standard for web APIs, configuration files, and data storage.
Despite its name, JSON is language-independent and supported by virtually every modern programming language including JavaScript, Python, Java, C#, PHP, Ruby, Go, and Rust.
Basic JSON Structure
JSON data is built from two primary structures:
Objects
Unordered collections of key-value pairs, enclosed in curly braces
{
"name": "Alice",
"age": 30,
"active": true
}Arrays [ ]
Ordered lists of values, enclosed in square brackets
[ "apple", "banana", "cherry" ]
JSON Data Types
JSON supports six fundamental data types:
1. String
Text enclosed in double quotes
"Hello, World!"2. Number
Integer or floating-point, no quotes
42, -17, 3.14159, 1.5e103. Boolean
True or false, lowercase only
true, false4. Null
Represents absence of value
null5. Object
Key-value pairs in curly braces
{ "key": "value", "nested": { "data": true } }6. Array
Ordered list in square brackets
[1, "mixed", true, null, {"object": "value"}]JSON Syntax Rules
- ✓Double Quotes Only: Keys and string values must use double quotes, not single
- ✓No Trailing Commas: Last item in object/array cannot have trailing comma
- ✓UTF-8 Encoding: Standard encoding, supports Unicode characters
- ✓No Comments: Standard JSON doesn't support comments (use JSON5 for comments)
- ✓Case Sensitive: Keys are case-sensitive: "Name" ≠ "name"
Nested JSON Structures
Real-world JSON often contains deeply nested objects and arrays:
{
"user": {
"id": 12345,
"profile": {
"name": "Alice Johnson",
"email": "alice@example.com",
"preferences": {
"theme": "dark",
"notifications": true
}
},
"roles": [
{"id": 1, "name": "admin", "permissions": ["read", "write", "delete"]},
{"id": 2, "name": "editor", "permissions": ["read", "write"]}
]
}
}When converting nested JSON to flat formats like CSV, you'll need flattening strategies.
Learn about Nested JSON Flattening →Common JSON Mistakes
❌ Single Quotes
Invalid: {'name': 'Alice'}Use double quotes for keys and strings
❌ Trailing Commas
Invalid: {"name": "Alice", "age": 30,}Remove comma after last item
❌ Unquoted Keys
Invalid: {name: "Alice"}Keys must be quoted strings
Validating JSON
Always validate JSON before processing to catch syntax errors:
JavaScript Validation
try {
const data = JSON.parse(jsonString);
console.log("Valid JSON:", data);
} catch (error) {
console.error("Invalid JSON:", error.message);
}💡 Pro Tip
Use our JSON validator and converter to check JSON syntax and convert to CSV or Excel with real-time error detection.
Authored by: JSON CSV Converter
Last updated: February 15, 2026