Example JSON Structures

Flat JSON

{
  "id": 1,
  "name": "John Doe",
  "email": "[email protected]"
}

Nested JSON

{
  "user": {
    "id": 1,
    "name": "Jane Smith"
  },
  "posts": [
    {
      "title": "First Post",
      "content": "Hello World"
    },
    {
      "title": "Second Post",
      "content": "More text"
    }
  ]
}

Nested JSON 2

{
  "user": { "id": 1, "name": "Alice" },
  "posts": [
    { "title": "Hello", "content": "World" },
    { "title": "Second", "content": "More text" }
  ]
}

Array of Objects

[
  {
    "productId": 1001,
    "productName": "Widget"
  },
  {
    "productId": 1002,
    "productName": "Gadget"
  }
]

JavaScript array of objects (Loose JSON)

[
  {
    color: "red",
    value: "#f00"
  },
  {
    color: "green",
    value: "#0f0"
  },
  {
    color: "blue",
    value: "#00f"
  },
  {
    color: "cyan",
    value: "#0ff"
  },
  {
    color: "magenta",
    value: "#f0f"
  },
  {
    color: "yellow",
    value: "#ff0"
  },
  {
    color: "black",
    value: "#000"
  }
]

Loose JSON: Missing Quotes on Keys

{
  color: "red",
  value: "#f00"
}

Keys are unquoted, which is invalid in strict JSON.

Loose JSON: Single Quotes Instead of Double Quotes

{
  'color': 'blue',
  'value': '#00f'
}

Uses single quotes for strings and keys instead of double quotes.

Loose JSON: Trailing Commas

{
  "color": "green",
  "value": "#0f0",
}

Trailing comma after the last key-value pair is invalid.

Back to Tool