Template:Infobox file format

The JSON Markup Language (JsonML) is a lightweight markup language which is used as a mapping between XML and JSON (JavaScript Object Notation). Using JsonML one may convert an XML document or fragment into a JSON data structure for ease of use within JavaScript environments such as a Web Browser. JsonML allows manipulation of XML data without the need or overhead of an XML parser.

JsonML has greatest applicability in Ajax web applications. It may be used to transport XHTML down to the client where it can be deterministically reconstructed into DOM Elements. Strategies such as progressive enhancement may be employed during construction to bind dynamic behaviors to the otherwise static elements.

Syntax Edit

JsonML uses JSON Arrays to represent XML elements, JSON Objects to represent attributes, and JSON Strings to represent Text nodes. Conversion from XML to JsonML is fully reversible. XML Namespaces are handled by prepending the element name with the namespace prefix (e.g. <myns:myElement/> becomes ["myns:myElement"]).

<!-- XML representation of a person record -->
<person created="2006-11-11T19:23" modified="2006-12-31T23:59">
    <address type="home">
        <street>12345 Sixth Ave</street>
/* JsonML representation of a person record */
["person", {"created":"2006-11-11T19:23", "modified":"2006-12-31T23:59"},
    ["firstName", "Robert"],
    ["lastName", "Smith"],
    ["address", {"type":"home"},
        ["street", "12345 Sixth Ave"],
        ["city", "Anytown"],
        ["state", "CA"],
        ["postalCode", "98765-4321"]