Hacker News new | ask | show | jobs
by lkuty 933 days ago
In fact XQuery alone is enough, e.g. with Saxon HE 12.3.

    (: file json2xml.xq :)
    declare default element namespace "http://www.w3.org/2005/xpath-functions";
    declare option saxon:output "method=text";
    declare variable $file as xs:string external;
    json-to-xml(unparsed-text($file))/<your xpath goes here>

    java -cp ~/Java/SaxonHE12-3J/saxon-he-12.3.jar net.sf.saxon.Query -q:json2xml.xq file='/path/to/file.json'