JsonML

JsonML

Infobox file format
name = JSON Markup Language
icon =
logo =


extension =
mime = application/jsonml+json (unofficial)
type code =
uniform type =
magic =
owner =
genre = Markup language
container for =
contained by =
extended from = XML and JSON
extended to =
standard =
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.

yntax

There are two forms of JsonML: The Array Form and the Object Form.

JsonML Array Form 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"] ).

Robert Smith

12345 Sixth Ave Anytown CA 98765-4321

JsonML Array Form 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"] ]

JsonML Object Form uses JSON Objects to represent XML elements and their attributes, and JSON Arrays to represent child node lists.

JsonML Object Form representation of a person record:

{"tagName": "person", "created": "2006-11-11T19:23", "modified": "2006-12-31T23:59"}, "childNodes": [ {"tagName": "firstName", "childNodes" : ["Robert"] }, {"tagName": "lastName", "childNodes" : ["Smith"] }, {"tagName": "address", "type":"home", "childNodes" : [ {"tagName": "street", "childNodes" : ["12345 Sixth Ave"] }, {"tagName": "city", "childNodes" : ["Anytown"] }, {"tagName": "state", "childNodes" : ["CA"] }, {"tagName": "postalCode", "childNodes" : ["98765-4321"] }, ] }]

The JSON Data Transformation produces a more compact representation but loses some of the document structural information.

{"person": { "address": { "city": "Anytown", "postalCode": "98765-4321", "state": "CA", "street": "12345 Sixth Ave", "type": "home" }, "created": "2006-11-11T19:23", "firstName": "Robert", "lastName": "Smith", "modified": "2006-12-31T23:59"

References

External links

* [http://jsonml.org JsonML.org]


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Lightweight markup language — A lightweight markup language is a markup language with a simple syntax, designed to be easy for a human to enter with a simple text editor, and easy to read in its raw form. Lightweight markup languages are used in applications where people… …   Wikipedia

  • JSON — infobox file format mime = application/json extension = .json genre = Data interchange standard = RFC 4627JSON (pronEng|ˈdʒeɪsɒn, i.e., Jason ), short for JavaScript Object Notation, is a lightweight computer data interchange format. It is a text …   Wikipedia

  • CougarXML — Developer(s) Massimiliano Guastafierro Written in JavaScript Operating system …   Wikipedia

  • Vereinfachte Auszeichnungssprache — Eine Vereinfachte Auszeichnungssprache ist eine Auszeichnungssprache mit einer einfachen Syntax, um Dokumente einfach manuell erstellen und lesen zu können. Meist werden Dokumente für die endgültige Darstellung in eine gewöhnliche… …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”