I'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.
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.
I propose a small change to the JSON specification, where a "name" can be optionally placed before the opening bracket of an object or array:
"employee": Employee {
...
},
"fibonacci": Sequence [1, 2, 3, 5]
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?