douglascrockford / JSON-js

JSON in JavaScript
http://www.JSON.org/
8.7k stars 4.59k forks source link

Json syntax #116

Closed mgwalm closed 5 years ago

mgwalm commented 5 years ago

Im getting lost. The standard at https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf says

value => string //etc object array array => [ values ] object => string : value values => value value, values therefor the following should be valid json:

[ "name" : { 1, 2, 3 }, 1, 2, 3 ]

whereas if i follow your syntax at json.org (the bit on the right) it isn't valid. also most other checkers ive tried say its not valid json.

However the bit on the left follows the standard.

The following follows ecma: "n" : {"name" :"value", "n":1, "k":2 }

however its invalid.

douglascrockford commented 5 years ago

You are misreading ECMA 404. If you are having trouble understanding grammar rules, then try using the railroad diagrams.