4 ms·
The possible syntax for Object literals is a lot more complicated than what JSON can contain. Hence the JSON parser is faster than the JS parser for the same ob
by shortercode 7y ago
The possible syntax for Object literals is a lot more complicated than what JSON can contain. Hence the JSON parser is faster than the JS parser for the same object.
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"
}