<story><title>Fixing JSON</title><url>https://www.tbray.org/ongoing/When/201x/2016/08/20/Fixing-JSON</url></story><parent_chain><item><author>outsidetheparty</author><text>Shameful confession: when I was first introduced to JSON, I was convinced it would go nowhere. &amp;quot;XML already does everything JSON does! And there&amp;#x27;s no way to differentiate between nodes and attributes! And there are no namespaces! And no schemas! What&amp;#x27;s the point of JSON?&amp;quot;  And a couple of years later I looked up from the tangled mess of XSLT I was working on to discover that the rest of the world had moved on.&lt;p&gt;JSON is just javascript, and it leaves out everything else.  That&amp;#x27;s its entire reason for existing, and it caught on because that&amp;#x27;s all that 99.44% of anyone needed.&lt;p&gt;Timestamps you can add today, without changing the protocol; just put them in your data if you need them.  So I&amp;#x27;m not sure what he&amp;#x27;s even proposing there.&lt;p&gt;Schemas:  OK, he doesn&amp;#x27;t like JSON Schema&amp;#x27;s anyOf.  Fair enough. There&amp;#x27;s no real proposal here for how to fix it, so not much to say here.&lt;p&gt;Replacing commas with whitespace sounds to me like replacing a very minor irritant with a constant full-body rash.  Stuff like his example of &amp;quot;IDs&amp;quot;: [ 116 943 234 38793 ] would lead to &lt;i&gt;far&lt;/i&gt; more confusion and errors than the occasional stray trailing comma.&lt;p&gt;So I guess I pretty much vote no on this one thanks for asking</text></item></parent_chain><comment><author>Normal_gaussian</author><text>&amp;gt; Replacing commas with whitespace sounds to me like replacing a very minor irritant with a constant full-body rash&lt;p&gt;Both vivid and accurate.&lt;p&gt;In order to combat trailing commas I normally place the comma on the following line,  e.g.&lt;p&gt;&lt;pre&gt;&lt;code&gt;    { &amp;quot;time&amp;quot;: &amp;quot;3 minutes past four&amp;quot;
    , &amp;quot;age&amp;quot;: 229
    , &amp;quot;sex&amp;quot;: &amp;quot;monoecious species&amp;quot;
    , &amp;quot;appearance&amp;quot;: &amp;quot;Tree-like.  It&amp;#x27;s a tree.&amp;quot;
    }

    uint8_t *data    &amp;#x2F;&amp;#x2F; Yada
          , *buffer  &amp;#x2F;&amp;#x2F; Ya
          ;

    var javascript
      , variable = 6
      , declarations = [ &amp;quot;This is taking too long&amp;quot;, &amp;quot;Yep&amp;quot; ]
      , mix = [ &amp;quot;Flour&amp;quot;, &amp;quot;Sugar&amp;quot;, &amp;quot;Water&amp;quot; ]
      , types = { &amp;#x27;old&amp;#x27;     : (d) =&amp;gt; { return d &amp;lt; new Date }
                , &amp;#x27;new&amp;#x27;     : (d) =&amp;gt; { return d &amp;gt; new Date }
                , &amp;#x27;borrowed&amp;#x27;: (o) =&amp;gt; { return false }
                , &amp;#x27;blue&amp;#x27;    : (c) =&amp;gt; { return true }
                }
      , regularly = new Date().toISOString()
      ;
    &lt;/code&gt;&lt;/pre&gt;
With such a format there is only ever a problem deleting the first line,  which I find is much much harder to do without also noticing what you&amp;#x27;ve done to the larger statement.</text></comment>
<story><title>Fixing JSON</title><url>https://www.tbray.org/ongoing/When/201x/2016/08/20/Fixing-JSON</url></story><parent_chain><item><author>outsidetheparty</author><text>Shameful confession: when I was first introduced to JSON, I was convinced it would go nowhere. &amp;quot;XML already does everything JSON does! And there&amp;#x27;s no way to differentiate between nodes and attributes! And there are no namespaces! And no schemas! What&amp;#x27;s the point of JSON?&amp;quot;  And a couple of years later I looked up from the tangled mess of XSLT I was working on to discover that the rest of the world had moved on.&lt;p&gt;JSON is just javascript, and it leaves out everything else.  That&amp;#x27;s its entire reason for existing, and it caught on because that&amp;#x27;s all that 99.44% of anyone needed.&lt;p&gt;Timestamps you can add today, without changing the protocol; just put them in your data if you need them.  So I&amp;#x27;m not sure what he&amp;#x27;s even proposing there.&lt;p&gt;Schemas:  OK, he doesn&amp;#x27;t like JSON Schema&amp;#x27;s anyOf.  Fair enough. There&amp;#x27;s no real proposal here for how to fix it, so not much to say here.&lt;p&gt;Replacing commas with whitespace sounds to me like replacing a very minor irritant with a constant full-body rash.  Stuff like his example of &amp;quot;IDs&amp;quot;: [ 116 943 234 38793 ] would lead to &lt;i&gt;far&lt;/i&gt; more confusion and errors than the occasional stray trailing comma.&lt;p&gt;So I guess I pretty much vote no on this one thanks for asking</text></item></parent_chain><comment><author>rkrzr</author><text>&amp;quot;Timestamps you can add today, without changing the protocol; just put them in your data if you need them. So I&amp;#x27;m not sure what he&amp;#x27;s even proposing there.&amp;quot;&lt;p&gt;He is proposing to add a timestamp &lt;i&gt;type&lt;/i&gt; to the grammar. This would have the advantage that there would be one canonical way to have timestamps in your JSON. It would also mean that the parser would already validate them for you and you would not have to do that yourself every time.&lt;p&gt;I definitely see value in that.</text></comment>