Objects

What is a JSON Object?

A JSON object is an unordered collection of key-value pairs. Each key is a string, and the value can be any valid JSON data type (string, number, boolean, null, array, or another object). Objects are enclosed in curly braces {}.

Syntax

{
  "key1": "value1",
  "key2": 123,
  "key3": {
    "nestedKey": "nestedValue"
  }
}

Notes

  • Keys must be strings enclosed in double quotes.

  • Values can be any JSON data type.

  • Commas separate the key-value pairs, with no trailing comma after the last pair.

Last updated