[Bug 27171] New: Outputting JSON, serializing sequences

https://www.w3.org/Bugs/Public/show_bug.cgi?id=27171

            Bug ID: 27171
           Summary: Outputting JSON, serializing sequences
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Serialization 3.1
          Assignee: cmsmcq@blackmesatech.com
          Reporter: christian.gruen@gmail.com
        QA Contact: public-qt-comments@w3.org

I know I should have replied earlier to Michael's requests on serializing JSON
(#26784), but I think that one issue is worth being discussed a bit more:

If sequences with zero items or more than one item are to be output on top
level, I would recommend not to output them as 'null' or as array:

* To me, serialization has always been a non-blocking operation. If we don't
know in advance if a query will yield more than one item, and if we treat
sequences as arrays, we would from now on need to cache the first item before
we know if it needs to be prefixed with a square bracket.

* In my perception, all other output methods handle sequences differently.
Think of the XML output method: multiple nodes will simply be appended to each
other, and the result won't be wrapped by an additional root element.

* Similarly, if a query does not yield any result, I would expect it not to
return any output at all, as is the case with the other output methods.

If sequences occur on a deeper level, an error may be more appropriate. This
way, parsing and serializing JSON will be more bidirectional. See the following
query as example:

  map { 'A': ('B','C') }

If the value of the map object would now be serialized as array, and if it was
parsed via fn:parse-json, we would get a different result.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Saturday, 25 October 2014 14:52:56 UTC