DevTools
Back to JSON Formatter

JSON Cheat Sheet

A quick reference for JSON syntax, data types, escape sequences, and common patterns. Copy-paste ready.

JSON Data Types

String

"hello world"
"line one\nline two"
"path: C:\\Users\\file"

Number

42
3.14
-17
1.0e10

Boolean

true
false

Null

null

Array

[1, 2, 3]
["a", "b", "c"]
[{"id": 1}, {"id": 2}]
[]

Object

{
  "name": "Alice",
  "age": 30,
  "active": true
}

Escape Characters

SequenceCharacterExample
\\nNewline"line1\nline2"
\\tTab"col1\tcol2"
\\\\Backslash"C:\\path"
\\"Double quote"say \"hi\""
\\/Forward slash"a\/b"
\\bBackspace"back\bspace"
\\fForm feed"form\ffeed"
\\rCarriage return"line\r\n"
\\uXXXXUnicode"\u00e9" (accent e)

Common JSON Patterns

Config File
{
  "database": {
    "host": "localhost",
    "port": 5432,
    "name": "myapp",
    "ssl": true
  },
  "logging": {
    "level": "info",
    "format": "json"
  }
}
API Response
{
  "status": 200,
  "data": {
    "users": [
      { "id": 1, "name": "Alice", "email": "alice@example.com" },
      { "id": 2, "name": "Bob", "email": "bob@example.com" }
    ],
    "total": 2,
    "page": 1
  },
  "meta": {
    "requestId": "abc-123",
    "timestamp": "2024-01-15T10:30:00Z"
  }
}
package.json Structure
{
  "name": "my-app",
  "version": "1.0.0",
  "description": "A sample project",
  "main": "index.js",
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "test": "vitest"
  },
  "dependencies": {
    "next": "^15.0.0",
    "react": "^19.0.0"
  },
  "devDependencies": {
    "typescript": "^5.0.0"
  }
}

JSON vs YAML vs XML

FeatureJSONYAMLXML
ReadabilityGoodExcellentModerate
VerbosityLowVery lowHigh
CommentsNoYes (#)Yes (<!-- -->)
Data types6 typesRich (dates, etc.)Strings only
Parsing speedFastModerateSlow
Native in JSYesNo (library)No (DOMParser)
Use caseAPIs, configsDevOps, configsEnterprise, docs

Got some JSON to validate or format?

Validate Your JSON →