JSON files turn up in app settings, website APIs, exported data from services and developer tools. The extension is .json, and the content is plain text, so you can open one in any editor. What takes a little learning is the structure.
What JSON stands for
JSON is short for JavaScript Object Notation. It began as a way for JavaScript programs to exchange data, but it is language-independent and is now supported by virtually every programming language. It is standardised as ECMA-404 and as RFC 8259, and its internet media type is application/json.
The building blocks
JSON has just six kinds of value:
- Object: an unordered set of name-and-value pairs in curly braces:
{"name": "Ada", "age": 36} - Array: an ordered list in square brackets:
[1, 2, 3] - String: text in double quotes:
"hello" - Number:
42,-3.5,1e6 - Boolean:
trueorfalse - Null:
null
Values can nest, so an object can contain arrays of objects, and so on. That is how JSON represents complex records:
{
"user": "ada",
"active": true,
"roles": ["admin", "editor"],
"address": { "city": "London", "postcode": null }
}
The strict rules
JSON is deliberately small, and it is strict about it:
- Strings and property names must use double quotes. Single quotes are not valid.
- No trailing commas after the last item in an object or array.
- No comments: neither
//nor/* */is allowed in standard JSON. - Numbers cannot have leading zeros (except for a single
0) or be written asNaNorInfinity. - Only the values listed above are allowed. There is no date type; dates are normally written as strings.
Most of the "my JSON will not load" problems come from the first three rules. See how to fix invalid JSON.
Where you will see JSON files
- Web APIs: servers send responses as JSON.
- Configuration: tools such as
package.jsonin JavaScript projects, editor settings and many app configs. - Data exports: downloads from social platforms, analytics tools and note apps.
- Data interchange: moving records between systems.
JSON vs other formats
JSON is more compact than XML and stricter than YAML. It does not support comments, which is why many config files use YAML or TOML instead. For spreadsheet-style data, CSV is often simpler. Comparing with XML is covered in JSON vs XML.
How to read and open a JSON file
You can read the raw text in any editor, but large single-line JSON is hard to follow. Pretty-printing adds indentation so the structure is visible. In the browser, Docento's Text & Markdown Editor opens .json files locally, shows them in a fixed-width font, checks the syntax as you type and has a Format JSON button. Details are in how to open a JSON file.
Common questions
Can a JSON file contain more than one object? A single JSON document has one top-level value. To hold several records, wrap them in an array, or use JSON Lines, where each line is its own document.
Is the order of keys meaningful? In the standard, an object is an unordered collection, so programs should not depend on key order, although most preserve it.
How big can a JSON number be? The grammar sets no limit, but many parsers read numbers as 64-bit floating point, which keeps integers exact only up to 2^53. Store very large identifiers as strings.
Can JSON hold dates, images or binary data? Not directly. Dates are conventionally strings in ISO 8601 format, and binary data is usually encoded as text, for example with Base64.
File size and encoding
JSON text should be encoded as UTF-8, according to RFC 8259 for data exchanged between systems. A byte order mark at the start is not allowed by that standard, though some tools tolerate it. Large JSON files load entirely into memory in most editors; for very large datasets consider a line-delimited format.
Takeaway
JSON is plain text built from objects, arrays, strings, numbers, booleans and null. It is strict about double quotes, trailing commas and comments, and any text editor or the online editor will open it.