Railroad

The JSON grammar as described at json.org except that the railroad diagrams are generated by JavaScript.

Check out the HTML source of this file. The styling of the nodes is entirely done in CSS, nodes can contain arbitrary HTML (though position:fixed might behave strangely), and grammars are declared using declarative-style JS function calls at the bottom of this file. This should work on any browser that supports CSS3 the border-bottom-right-radius property et al. for doing rounded corners -- no SVG required.


An object is an unordered set of name/value pairs.

An array is an ordered collection of values.

A value can be a string in double quotes, a number, a keyword value, an object, or an array.

A string is a sequence of zero or more UTF-16 Unicode code units.

A number is very much like a C or Java number, except that the octal and hexadecimal formats are not used, and there is no letter suffix to specify size or signedness.

Whitespace can be inserted between any pair of tokens outside strings. Excepting a few encoding details, that completely describes the language.