JavaScript library providing XML to JSON two-way transformations
JSONX is a JavaScript library which allows simple transformation between XML and JSON.
Please check back again soon to find more information and some examples.
JSONX.build(Array|String)
JSONX.parse(Node|Node[]|NodeList|String)
JSONX.stringify(Node|Node[]|NodeList|String)
The following ANTLR grammar represents the XML to JSON transformation;
ELEMENT
: '[' ELEMENT_NAME (',' '{' ATTRIBUTE_LIST? '}')? (',' ELEMENT_LIST)? ']'
| STRING
;
ELEMENT_NAME : STRING ;
ATTRIBUTE_LIST
: ATTRIBUTE ',' ATTRIBUTE_LIST
| ATTRIBUTE
;
ATTRIBUTE : ATTRIBUTE_NAME ':' ATTRIBUTE_VALUE ;
ATTRIBUTE_NAME : STRING ;
ATTRIBUTE_VALUE
: STRING
| NUMBER
| BOOLEAN
| NULL
;
ELEMENT_LIST
: ELEMENT ',' ELEMENT_LIST
| ELEMENT
;
BOOLEAN
: 'true'
| 'false'
;
NULL : 'null' ;
NUMBER : '0'..'9'+ ;
STRING : 'a'..'z'+ ;
If you have any problems with this library or would like to see the changes currently in development browse our issues.
Take a look at the documentation to get a better understanding of what the code is doing.
If that doesn't help, feel free to follow me on Twitter, @neocotic.