Introducing JSON

JavaScript Object Notation (JSON) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999. This feature can also be found in Python. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, TCL, and many others. These properties make JSON an ideal data-interchange language.

JSON is built on two structures:

JSON-object :
{ property-list }
property-list :
string-literal : value
property-list , string-literal : value
value :
JSON-array :
[ element-list ]
element-list :
element-list , value

These are universal data structures. Virtually all modern programming languages support them in one form or another. It makes sense that a data format that is interchangable with programming languages also be based on these structures.

In JSON, they take on these forms:

Excepting a few encoding details, this completely describes the language.

Strings are very much like C or Java strings. Numbers are very much like C or Java numbers, except that the octal and hexadecimal formats are not used.

See JSON in Java for an example set of Java classes that parse, generate, and manipulate JSON data strings. See JSON in JavaScript for a note on using JSON notation with JavaScript. Also see The Fat-free Alternative to XML. See an example of a JSON-encoded message.