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:
- Object — a collection of name/value pairs, enclosed in curly braces
{} - 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
| Type | Example |
|---|---|
| String | "Hello, World!" |
| Number | 42, 3.14, -7 |
| Boolean | true, false |
| Null | null |
| Object | { "key": "value" } |
| Array | [1, 2, 3] |
Common JSON Syntax Errors
- Trailing commas:
{"a": 1, "b": 2,}— the last comma is invalid - Single quotes:
{'key': 'value'}— JSON requires double quotes - Unquoted keys:
{key: "value"}— keys must be quoted strings - Comments: JSON does not support comments (use JSONC or JSON5 for that)
- Undefined values:
undefinedis 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.