<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>24436</bug_id>
          
          <creation_ts>2014-01-29 09:52:23 +0000</creation_ts>
          <short_desc>[XSLT 3.0] Poorly-designed JSON example</short_desc>
          <delta_ts>2014-02-24 15:51:53 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XSLT 3.0</component>
          <version>Last Call drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Kay">mike</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          <cc>fgeorges</cc>
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>99393</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-01-29 09:52:23 +0000</bug_when>
    <thetext>The JSON example in 21.2.1 is rather inelegant in that the only array it contains (the phone numbers) contains a single entry (a map), and it&apos;s not clear why an array is needed here. It&apos;s legal JSON, but not a very good example.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99494</commentid>
    <comment_count>1</comment_count>
    <who name="Florent Georges">fgeorges</who>
    <bug_when>2014-01-30 20:06:41 +0000</bug_when>
    <thetext>(In reply to Michael Kay from comment #0)
&gt; The JSON example in 21.2.1 is rather inelegant in that the only array it
&gt; contains (the phone numbers) contains a single entry (a map)

It looks like it is an adaptation of an example I&apos;ve sent on the mailing list, which I took from the Wikipedia page for JSON &lt;http://en.wikipedia.org/wiki/JSON&gt;.  But the value of the array has been changed from:

    &quot;phone numbers&quot; :  [ 
       { &quot;type&quot;: &quot;home&quot;, 
         &quot;number&quot;: &quot;212 732-1234&quot;
       },
       { &quot;type&quot;: &quot;fax&quot;, 
         &quot;number&quot;: &quot;646 123-4567&quot;
       }
    ]

to:

    &quot;phone numbers&quot; :  [ 
       { &quot;home&quot;: &quot;212 732-1234&quot;, 
         &quot;fax&quot;: &quot;646 123-4567&quot;
       }
    ]

The first one looks legitimate to me, WRT having an array.  I can try and come with another example, but this one (with the above modification) looks good to me.

By the way, the example also uses spaces in the names.  As far as I can see, this is valid syntax, but I guess it would generate an error if someone tries to parse it as a Javascript object.  Do we want to remove spaces in names?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99667</commentid>
    <comment_count>2</comment_count>
    <who name="Florent Georges">fgeorges</who>
    <bug_when>2014-02-04 18:54:29 +0000</bug_when>
    <thetext>Another candidate, self-explanatory, with strings, numbers, a date-time, a boolean, null, objects, and legitimate arrays:

    {
      &quot;desc&quot;    : &quot;Distances between several cities, in kilometers.&quot;,
      &quot;updated&quot; : &quot;2014-02-04T18:50:45&quot;,
      &quot;uptodate&quot;: true
      &quot;author&quot;  : null
      &quot;cities&quot;  : {
        &quot;Brussels&quot;: [
          {to: &quot;London&quot;,    distance: 322},
          {to: &quot;Paris&quot;,     distance: 265},
          {to: &quot;Amsterdam&quot;, distance: 173}
        ],
        &quot;London&quot;: [
          {to: &quot;Brussels&quot;,  distance: 322},
          {to: &quot;Paris&quot;,     distance: 344},
          {to: &quot;Amsterdam&quot;, distance: 358}
        ],
        &quot;Paris&quot;: [
          {to: &quot;Brussels&quot;,  distance: 265},
          {to: &quot;London&quot;,    distance: 344},
          {to: &quot;Amsterdam&quot;, distance: 431}
        ],
        &quot;Amsterdam&quot;: [
          {to: &quot;Brussels&quot;, distance: 173},
          {to: &quot;London&quot;,   distance: 358},
          {to: &quot;Paris&quot;,    distance: 431}
        ]
      }
    }</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99703</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-02-04 23:07:21 +0000</bug_when>
    <thetext>Thanks. But the &quot;to&quot; and &quot;distance&quot; should be in quotes, surely?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100330</commentid>
    <comment_count>4</comment_count>
    <who name="Florent Georges">fgeorges</who>
    <bug_when>2014-02-11 21:42:02 +0000</bug_when>
    <thetext>I used plain JavaScript notation, which does not require to quote object member names when they follow the rules for variable names. But from http://tools.ietf.org/html/rfc4627, it seems you are right and quotes are indeed required for names, always.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100967</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-02-20 16:46:25 +0000</bug_when>
    <thetext>I have used the example in comment #2, with quotes added to make it legal.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>