Project

Profile

Help

Support #6190

closed

Forward slash escaped when using xml-to-json function

Added by fouad MOUTASSIM about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
JSON
Sprint/Milestone:
Start date:
2023-09-01
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
10
Fix Committed on Branch:
10
Fixed in Maintenance Release:
Platforms:
Java

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

payload.xml (2.1 KB) payload.xml fouad MOUTASSIM, 2023-09-01 14:51
m-tbw-map-qualtricsTransientV6.xslt (63.1 KB) m-tbw-map-qualtricsTransientV6.xslt fouad MOUTASSIM, 2023-09-01 14:51
Json_output.png (90.8 KB) Json_output.png fouad MOUTASSIM, 2023-09-01 14:59
Actions #1

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

Actions #2

Updated by fouad MOUTASSIM about 1 year ago

Please find attached the output payload

Actions #3

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.

Actions #4

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".

Actions #5

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

Also available in: Atom PDF