Project

Profile

Help

JSON

Added by Anonymous about 14 years ago

Legacy ID: #8762209 Legacy Poster: CR  (crxsl)

Can you convert a JSON object to XML using Saxon Java Parser (Saxon HE 9.2)? Thanks


Replies (2)

RE: JSON - Added by Anonymous about 14 years ago

Legacy ID: #8763779 Legacy Poster: Michael Kay (mhkay)

No, sorry, there's no current support in Saxon for parsing JSON. It's something I would like to add. One possibility is to parse it into the format defined by John Snelson at http://snelson.org.uk/archives/2008/02/parsing_json_in.php. Another possibility is to parse it into a combination of maps, sequences, and atomic values (using the new Map extension in Saxon 9.3). If you have input on the requirements, and use cases, please share them!

RE: JSON - Added by Anonymous about 14 years ago

Legacy ID: #8763831 Legacy Poster: David Lee (daldei)

I'm currently working on a long term project to support lossless JSON-XML mapping. Its got a way to go. But some of the early phases will be released shortly (by next week) in the next version of xmlsh (www.xmlsh.org) This includes a parser and serializer of JSON to/from a specific JSON XML format which can accomidate any JSON data losslessly. However I consider it an 'intermediate format' because the XML is very JSON specific. Its simple though, so can be parsed with Saxon (xslt/xquery/xpath) very trivially, and in fact uses saxon internally. An simple example JSON: { "foo" : "bar" , "array" : [1 , 2 , "three" ]} XML (lets hope the tags survive the post) [quote] bar 1 2 three [/quote] I will post back here when this is released (soon!). Look for the "json2xml" and "xml2json" commands. -David Lee www.xmlsh.org

    (1-2/2)

    Please register to reply