Saved

Utilix knowledge base

What Is JSON?

Published Apr 17, 2026

JSON (JavaScript Object Notation) is a lightweight, text-based data interchange format. It was derived from JavaScript object syntax but is language-independent — virtually every programming language can read and write JSON.

JSON Syntax

JSON is built on two structures:

  1. Object — a collection of name/value pairs, enclosed in curly braces {}
  2. Array — an ordered list of values, enclosed in square brackets []
{
  "name": "Alice",
  "age": 30,
  "active": true,
  "scores": [95, 87, 92],
  "address": {
    "city": "London",
    "country": "GB"
  },
  "nickname": null
}

JSON Value Types

TypeExample
String"Hello, World!"
Number42, 3.14, -7
Booleantrue, false
Nullnull
Object{ "key": "value" }
Array[1, 2, 3]

Common JSON Syntax Errors

  1. Trailing commas: {"a": 1, "b": 2,} — the last comma is invalid
  2. Single quotes: {'key': 'value'} — JSON requires double quotes
  3. Unquoted keys: {key: "value"} — keys must be quoted strings
  4. Comments: JSON does not support comments (use JSONC or JSON5 for that)
  5. Undefined values: undefined is not a valid JSON value

JSON vs XML

JSON has largely replaced XML for web APIs because it is:

  • More compact (less verbose)
  • Natively parsed by JavaScript
  • Easier to read and write by hand
  • Directly mappable to data structures in most languages

XML is still preferred for document-oriented formats, SOAP services, and systems requiring schema validation (XML Schema).

Formatting and Minifying

Pretty-printed JSON adds indentation and newlines to make it human-readable:

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

Minified JSON removes all unnecessary whitespace to reduce byte size:

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

Use the JSON Formatter tool to format or minify JSON instantly in your browser.