JSON Cheat Sheet - Complete Reference Guide

Master JSON syntax and structure with this comprehensive reference guide. Learn about JSON data types, formatting, and best practices with our interactive JSON playground.

Interactive JSON Playground

Quick Reference
Data Types
"string" - Text
42 - Number
true/false - Boolean
null - Null value
[] - Array
{} - Object
Rules
✓ Use double quotes
✓ No trailing commas
✓ No comments
✓ No functions
Reference

JSON Complete Guide

What is JSON?

JSON (JavaScript Object Notation) is a lightweight, text-based data interchange format. It's easy for humans to read and write, and easy for machines to parse and generate. Despite its name suggesting a connection to JavaScript, JSON is language-independent.

Features of Our JSON Tool

  • JSON Validator: Validate JSON syntax and structure
  • JSON Formatter: Format and beautify JSON data
  • Interactive Playground: Test JSON data in real-time
  • Comprehensive Reference: Complete guide to JSON syntax and data types
  • Best Practices: Guidelines for clean and valid JSON
JSON

Complete JSON Reference

Master JSON syntax and structure with this comprehensive reference guide. Learn about JSON data types, formatting, and best practices.

Basic JSON Syntax

{"name": "John Doe","age": 30,"isEmployed": true,"spouse": null,"hobbies": ["reading", "swimming"],"address": {"street": "123 Main St","city": "New York","zipCode": "10001"}}

JSON Data Types

"string"Text in double quotes
42Number (integer or float)
true / falseBoolean values
nullNull value
[]Array (ordered list)
{}Object (key-value pairs)
"2023-01-01"Date as string
3.14159Decimal numbers

JSON Arrays

// Empty array
[]["apple", "banana", "orange"][1, 2, 3, 4, 5]["John", 30, true, null][[1, 2], [3, 4], [5, 6]][{"name": "John", "age": 30},{"name": "Jane", "age": 25}]

JSON Objects

// Empty object
{}
{"name": "John","age": 30}
{"person": {"name": "John","contact": {"email": "john@example.com","phone": "+1234567890"}}}
{"company": "Tech Corp","employees": [{"name": "John", "role": "Developer"},{"name": "Jane", "role": "Designer"}]}

Common JSON Patterns

API Response
{"status": "success","data": {"users": [...],"total": 150},"message": "Users retrieved"}
Configuration File
{"database": {"host": "localhost","port": 5432,"name": "myapp"},"features": {"auth": true,"cache": false}}

JSON Rules & Best Practices

✓ Use double quotesKeys and strings must use double quotes
✓ No trailing commasLast item shouldn't have a comma
✓ Use camelCaseConsistent naming convention
✓ Validate structureEnsure proper JSON syntax
✗ No commentsJSON doesn't support comments
✗ No functionsOnly data, no executable code
✗ No undefinedUse null instead of undefined
✗ No single quotesMust use double quotes only

JSON Key Features & Use Cases

JSON is widely used for:

  • Web APIs and REST Services: Standard format for API responses
  • Configuration Files: Application settings and preferences
  • Data Storage and Transmission: Efficient data exchange
  • AJAX Requests and Responses: Asynchronous web communication
  • NoSQL Databases: Document-based data storage
  • Package Managers: package.json files for Node.js projects

JSON Best Practices

Follow these guidelines for clean and valid JSON:

  • Use Double Quotes: Keys and strings must use double quotes
  • No Trailing Commas: Last item shouldn't have a comma
  • Consistent Naming: Use camelCase for property names
  • Validate Structure: Ensure proper JSON syntax
  • No Comments: JSON doesn't support comments
  • Use Null: Use null instead of undefined