Transforming JSON input
I propose to implement a
-json option on the command line, as recently done for the Java product; this allows the principal input of the transformation to be JSON rather than XML.
To achieve this I propose to extend the
SaxonJS.transform() API so that the options
sourceText can be JSON rather than XML; to indicate this we add another option
sourceMediaType whose values can be
application/xml or applicationi/json
for JSON, defaulting toapplication/xml`.
Note: it appears that the
SaxonJS.transform() API supports a
globalContextItem option that is missing from the documentation.
Updated by Michael Kay about 3 years ago
- Tracker changed from Bug to Feature
- Category set to Command line
- Priority changed from Low to Normal
- Applies to JS Branch Trunk added
- Fix Committed on JS Branch Trunk added
This feature is now implemented.
The command line now accepts a -json:filename argument as an alternative to the -s argument.
transform() API (both sync and async versions) treat
sourceText as JSON if the sourceType:"json" option is specified.
Please register to edit this issue