
Ask HN: JSON with names? - kizer
I&#x27;ve been thinking about the differences between XML and JSON. A key constraint in XML is that all elements are named; in JSON, all objects are anonymous by default.<p>Of course, it&#x27;s simple to add a &quot;name&quot; or &quot;type&quot; field. However, the name of the object ought to be denoted differently than its contents, IMHO.<p>I propose a small change to the JSON specification, where a &quot;name&quot; can be optionally placed before the opening bracket of an object or array:<p><pre><code>    &quot;employee&quot;: Employee {
    ...
    }, 
    &quot;fibonacci&quot;: Sequence [1, 2, 3, 5]

</code></pre>
Any thoughts? Would this burden parsing or serialization?
======
angersock
> Any thoughts? Would this burden parsing or serialization?

It's solving a problem we don't have.

> Of course, it's simple to add a "name" or "type" field. However, the name of
> the object ought to be denoted differently than its contents, IMHO.

Why?

