Thank you very much, Gerrit, interesting! But I am unwilling to get tangled up (in blue, like Bob Dylan, or not), I want clarity. It could not be simpler: I want to preserve information content, character for character: (a) when parsing JSON syntax into an XML node tree, (b) when serializing an XML node tree representation of JSON into JSON syntax. At least I want clean roundtripping, where output information is equal to input information. (Which is a lesser requirement than a+b.).
Currently, it is not clear to me how to do it, and I want to learn. Besides, I think it is a bug if roundtripping involves a change of information.
If I oversimplify things, I would like to learn why.
Have a cozy Sunday -
Hans
PS: To demonstrate the issue:
let $j1 := '{"key":"a/b"}'
let $x := json:parse($j1)
let $j2 := json:serialize($x)
return ($j1, $x, $j2)
yields:
{"key":"a/b"}
<json type="object">
<key>a/b</key>
</json>
{
"key":"a\/b"
}
PPS: Please do not even dream of thinking about considering or not excluding to change the parsers behaviour which leaves the slash as it is - otherwise you cannot use JSON information in XML representation without wiggling around - e.g. follow links, imagine. It's the serializer who gets it wrong.