Support #6190
closedForward slash escaped when using xml-to-json function
0%
Description
Hi,
When we try to excute the xml-to-json function we got the forward slash escaped which cause errors in our side. Could you please tell us how could we avoid this escape.
Exp : input >> "uniqueIdentifier": "00345963/4" output >> "uniqueIdentifier": "00345963 / 4"
We are using saxon-ee-10.4
Please find attached the xslt map and the payload.
Thank yo in advance.
Best Regards. Fouad
Files
Updated by fouad MOUTASSIM about 1 year ago
fouad MOUTASSIM wrote:
Hi,
When we try to excute the xml-to-json function we got the forward slash escaped which cause errors in our side. Could you please tell us how could we avoid this escape.
Exp : input >> "uniqueIdentifier": "00345963/4" output >> "uniqueIdentifier": "00345963/4"
We are using saxon-ee-10.4
Please find attached the xslt map and the payload.
Thank yo in advance.
Best Regards. Fouad
Updated by fouad MOUTASSIM about 1 year ago
- File Json_output.png Json_output.png added
Please find attached the output payload
Updated by Martin Honnen about 1 year ago
As a workaround, where you do xml-to-json($json)
, you can use xml-to-json($json) => parse-json() => serialize(map{ 'method' : 'json', 'use-character-maps' : map { '/' : '/' } })
instead. Kind of convoluted and I am only suggesting that as a possible workaround if you want a JSON output without the solidus/forwards slash being escaped,to move on with your code.
Updated by Michael Kay about 1 year ago
Saxon is doing what the spec says. Escaping of forward slash is recommended because the generated JSON might be used in an HTML script
element, where it could potentially cause problems.
This is an aspect of the 3.1 serialization spec that many people dislike and in the 4.0 specification there is an option to suppress it (which is implemented in recent commercial versions of Saxon). See https://github.com/qt4cg/qtspecs/issues/530
Add the serialization option escape-solidus="no".
Updated by Michael Kay about 1 year ago
- Tracker changed from Bug to Support
- Status changed from New to Closed
See also https://saxonica.plan.io/issues/5225
Closing as this is not a bug and the issue has been addressed.
Please register to edit this issue