I think, that the parse part is even correct (the strange entities come from the xml serialization). But it's still a problem because this query returns false:
import module namespace json = "http://www.zorba-xquery.com/modules/json";
declare variable $local:json := '{ "special-chars": { "unicode": "\u007B", "quote": "\"", "backslash": "\\", "backspace": "\b", "formfeed": "\f", "newline": "\n", "carriage return": "\r", "horizontal tab": "\t", "solidus": "\/" } }';
json:serialize(json:parse($local:json)) eq $local:json
I think, that the parse part is even correct (the strange entities come from the xml serialization). But it's still a problem because this query returns false:
import module namespace json = "http:// www.zorba- xquery. com/modules/ json";
declare variable $local:json :=
"backslash" : "\\",
"backspace" : "\b",
"formfeed" : "\f",
"horizontal tab": "\t",
'{ "special-chars": {
"unicode": "\u007B",
"quote": "\"",
"newline": "\n",
"carriage return": "\r",
"solidus": "\/"
}
}';
json:serialize( json:parse( $local: json)) eq $local:json