Hi, I'm trying to deactivate the escaping of characters for JSON serialization. It does not work with this: let $json := <map xmlns="http://www.w3.org/2005/xpath-functions"> <string key="url">http://some.url/path/to/somewhere</string></map> return json:serialize($json, map {'format' : 'basic', 'escape': 'no'}) Output: { "url":"http:\/\/some.url\/path\/to\/somewhere" } If I use the other JSON format it works: json:serialize(<json type='object'><url>http://some.url/path/to/somewhere</url></json>, map { "escape" : "no"}) Output: { "url":"http://some.url/path/to/somewhere" } Is the "escape" parameter not supported for the basic format? Best regards Johannes
Am 27.02.2020 um 07:49 schrieb Johannes Bauer:
I'm trying to deactivate the escaping of characters for JSON serialization.
It does not work with this:
let $json := <map xmlns="http://www.w3.org/2005/xpath-functions"> <string key="url">http://some.url/path/to/somewhere</string></map> return json:serialize($json, map {'format' : 'basic', 'escape': 'no'})
Output: { "url":"http:\/\/some.url\/path\/to\/somewhere" }
Does serialize(<map xmlns="http://www.w3.org/2005/xpath-functions"> <string key="url">http://some.url/path/to/somewhere</string></map>, map { 'method' : 'json', 'use-character-maps' : map { '/' : '/'}}) do what you want?
participants (2)
-
Johannes Bauer -
Martin Honnen