Feature #3676


Implement serialization to JSON

Added by Debbie Lockett almost 6 years ago. Updated over 5 years ago.

Start date:
Due date:
% Done:


Estimated time:
Applies to JS Branch:
1.0, Trunk
Fix Committed on JS Branch:
1.0, Trunk
Fixed in JS Release:
SEF Generated with:
Contact person:
Additional contact persons:


The Saxon-JS implementation of fn:serialize() is non-conformant (see!conformance/xslt30 and It's generally on our "todo" list to improve the implementation.

One place we should perhaps start is with serializing to JSON. This could be important to provide a decent mechanism for converting XDM maps to JSON objects. This especially becomes relevant following the changes in the way we convert between XDM maps and JavaScript objects (see

The suggested mechanisms for conversion from a JSON object to a XDM map, and back, are then:

  • JS to XDM: JSON.stringify() in JavaScript, then parse-json() in XSLT

  • XDM to JS: serialize() to JSON in XSLT, then JSON.parse() in JavaScript

Actions #1

Updated by Debbie Lockett almost 6 years ago

Some work in progress committed on 1.0 branch, to get more of the QT3 fn-serialize tests passing (i.e. more of those which test serializing to JSON).

More to be done; and need to also copy changes to trunk branch.

Actions #2

Updated by Debbie Lockett over 5 years ago

  • Status changed from New to Resolved
  • Fix Committed on JS Branch 1.0, Trunk added

Further code changes committed to 1.x branch, and copied over to 2.0 branch.

All QT3 fn-serialize (to JSON) tests are now passing (under Nashorn testing).

Actions #3

Updated by Debbie Lockett over 5 years ago

Further details added to the documentation (under conformance/xslt30) to document the restrictions for the relevant serialization parameters, for serialization to JSON:

  • allow-duplicate-names is implemented

  • byte-order-mark is ignored, the default is "no"

  • encoding is ignored, the default is "utf-8"

  • indent is ignored, no extra whitespace is added

  • json-node-output-method is ignored, serialization of nodes calls fn:serialize() with options map{[method":"xml", "omit-xml-declaration]("yes"})

  • media-type is ignored

  • normalization-form is ignored, the default is "none"

  • use-character-maps is ignored.

Actions #4

Updated by Debbie Lockett over 5 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in JS Release set to Saxon-JS 1.1.0

Bug fix applied in the Saxon-JS 1.1.0 maintenance release.

Please register to edit this issue

Also available in: Atom PDF Tracking page