Your support for our advertisers helps cover the cost of hosting, research, and maintenance of this FAQ

The XML FAQ — Frequently-Asked Questions about the Extensible Markup Language

Section 4: Developers

Q 4.10: What about JSON?

What about it?

JavaScript Object Notation (JSON) (http://json.org/) is a data-interchange format for programs written in JavaScript and other languages sharing the same C-like conventions. The standard (RFC 4627) says it is ‘a lightweight, text-based, language-independent data interchange format’ for the ‘portable representation of structured data’.

It is very suitable for representing rectangular data (row-and-column data, see the topic ‘Data-style applications’ in question D.14 on ‘What is my information? DATA or DOCUMENT?’) including that destined for (or sourced from) spreadsheets, name/value pairs, relational databases, and similar sources, particularly where the structure is not deeply nested.

It is not suited to the storage of information using Mixed Content (see the topic ‘Document-style applications’ in question D.14 on ‘What is my information? DATA or DOCUMENT?’), the normal ‘document’ XML format where text and markup are intermingled to any depth, such as in traditional XML applications like DocBook, TEI, JATS, HTML, etc. In such cases, JSON becomes unwieldy and rapidly ceases to be human-readable.

There are ongoing discussions at

Jason Polis writes:

JSON (JavaScript Object Notation) is a simple way to write structured data as lists of values in a text format.

The lists are either arrays of unnamed values in square brackets, [1,"b",true], or objects having named values in curly braces: {"a":1,"b":"b","c":true} . The values are quoted strings, decimal numbers, boolean, null and further lists.

JSON (ECMA-404) https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf is based on a subset of Javascript. JSON5 https://json5.org/ is a variation allowing more Javascript features. I-JSON (RFC 7493) https://tools.ietf.org/html/rfc7493 is stricter, requiring names in a list to be unique, and the text to be encoded as UTF-8.