Great Question. (awaiting answer from the experts)
One thing to consider is that there is *no standard mapping from XML to
JSON*
So whatever ML may or may not provide its unlikely to do what you think
it should.
Thats not to say that you cant convert specific XML to specific JSON but
there is no generalized agreed on way to do it.
Simple example (it gets WAY worse).
convert
<element attr="foo">bar</element>
To JSON
Pick a way
Pick another.
which is better ? which is "right" ?
Now add
<element attr="foo">bar<spam bold="true">bletch</spam>more text
<empty/></element>
Did the way you first pick work for this too ?
From: [email protected]
[mailto:[email protected]] On Behalf Of helen chen
Sent: Tuesday, April 20, 2010 12:32 PM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] question about json in marklogic 4
Does marklogic 4 has API that can convert xml node to json format
string?
I tried xdmp:to-json() function, it seems that it only wrap the xml node
with double quote, didn't convert the xml node to json format.
like:
let $a := <a><b>test</b></a>
return xdmp:to-json($a)
I got result "<a><b>test</b></a>"
Did I miss anything? Or does that mean I have to convert the xml to a
xquery map and then call the function?
Helen
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general