|
I've recently come across XSugar (http://www.brics.dk/xsugar/). It seems ideally suited for XML-JSON translation, using a single rule set which can be used in both directions.
From the web site:
"An XSugar specification is built around a context-free grammar that unifies the two syntaxes of a language. Given such a specification, the XSugar tool can translate from alternative syntax to XML and vice versa. Moreover, the tool statically checks that the transformations are reversible (i.e. bidirectional) and that all XML documents generated from the alternative syntax are valid according to a given XML schema."
I have used it for some reasonably serious work, including conversion between the normal algebraic form of an equation and MathML, and it works as advertised.
|