Project

Profile

Help

Bug #3350

closed

Define rules for parsing JSON with liberal=true

Added by Michael Kay about 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Saxon extensions
Sprint/Milestone:
-
Start date:
2017-07-13
Due date:
% Done:

100%

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

Description

The Saxon documentation does not say what the rules are for parsing JSON with liberal=true.

Also, there are no tests for this option (because the results are not interoperable).

Actions #1

Updated by Michael Kay about 7 years ago

Add the following rules (for liberal=true) to the Saxon documentation for parse-json:

           <li>Within arrays and objects, trailing commas are ignored: for example <code>[1,2,3,]</code>
              is treated as <code>[1,2,3]</code>. (This does not apply if the array or object is otherwise empty,
            so <code>[,]</code> and <code>{,}</code> are not accepted.)</li>

            <li>Within numeric literals, anything accepted by the XPath string-to-double casting rules
              is accepted (for example, leading plus signs, leading zeroes, absent fractional part, absent integer part.)</li>

            <li>Within a string literal, if backslash is followed by a character <code>X</code> and <code>\X</code>
              is not a recognized JSON escape sequence, then it is treated as representing the character <code>X</code>.</li>

            <li>The key of a key-value pair in an object can be written without quotation marks provided it takes the
              form of an XML NCName, and is not "true", "false", or "null".</li>

Added tests (to qt3extra) for these conditions.

Tweaked the code to pass the test cases. Patch committed on the 9.8 branch.

Actions #2

Updated by Michael Kay about 7 years ago

  • Status changed from New to Resolved
  • Fix Committed on Branch 9.8 added
Actions #3

Updated by O'Neil Delpratt almost 7 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 9.8.0.4 added

Bug fix applied in the Saxon 9.8.0.4 maintenance release.

Please register to edit this issue

Also available in: Atom PDF