- 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 andJSON
extended to =
standard =The JSON Markup Language (JsonML) is a lightweight markup language which is used as a mapping betweenXML andJSON (JavaScript Object Notation). Using JsonML one may convert anXML document or fragment into a JSON data structure for ease of use withinJavaScript environments such as aweb browser . JsonML allows manipulation of XML data without the need or overhead of anXML 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 asprogressive 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
Array s 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 Namespace s are handled by prepending the element name with the namespace prefix (e.g.<myns:myElement/>
becomes["myns:myElement"]
).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
Array s 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.