Bug #2692
closedIncorrect output from xml-to-json function, for an empty array inside an array
100%
Description
Raised by a user on the support mailing list.
Applying the xml-to-json() function to the following input:
<number>3</number>
<array/>
<number>4</number>
Returns the JSON output:
[3,[]4]i.e. there is a comma separator missing after the empty array.
Updated by Michael Kay over 8 years ago
Also applies where an empty map is output within an array.
Updated by Debbie Lockett over 8 years ago
- Status changed from New to In Progress
- Assignee set to Debbie Lockett
Updated by Debbie Lockett over 8 years ago
Tests xml-to-json-A014, xml-to-json-A015, xml-to-json-B014, xml-to-json-B015 added to the XSLT 3.0 test suite. Testing both empty arrays and empty maps inside an array.
Updated by Debbie Lockett over 8 years ago
- Status changed from In Progress to Resolved
- Fix Committed on Branch 9.7 added
The problem was that JsonReceiver was not setting atStart to false after processing an empty map or array.
Fix made to JsonReceiver.endElement() to set atStart=false unconditionally.
Patch committed on 9.7 and dev branches.
Updated by Debbie Lockett over 8 years ago
Another user has pointed out that the same bug affects maps containing an empty map or array as the value of a pair (which is not the last).
e.g. xml-to-json(json-to-xml({A":{},"B":1})) returns {"A":{}"B --- with a missing comma.
The patch already committed for this bug fixes this issue. Further new tests (xml-to-json-A017, A018, B017, B018) have been added to the XSLT 3.0 test suite.
Updated by O'Neil Delpratt over 8 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.7.0.5 added
Bug fix applied in the Saxon 9.7.0.5 maintenance release.
Please register to edit this issue