Because the JSON grammar is much simpler than JavaScript’s grammar, JSON can be parsed more efficiently than JavaScript. Hmm.. shouldn't that hold for most programming languages then? Let's try it for PHP: time php -r 'for ($i=0;$i So for 10 million repetitions, a small PHP structure is about 20x faster then parsing JSON. But to test the point of the article, one should use the sama data structure it uses ( https://r…
JS object literals allow such fun things as:
{
"foo": "bar",
foo1: function () { return "bar" },
foo2: () => "bar",
foo3 () { return "bar" },
get foo4 () { return "bar" },
["foo5"]: () => "bar"
}