Test name | Executions per second |
---|---|
JSON.parse() | 675628.0 Ops/sec |
eval() | 765278.7 Ops/sec |
var jsonString = '{"user":{"id":1,"name":{"first":"太郎","last":"山田"},"age":30,"email":"taro.yamada@example.com","address":{"street":"1-2-3","city":"東京","prefecture":"東京都","postalCode":"100-0001"},"phoneNumbers":[{"type":"mobile","number":"090-1234-5678"},{"type":"home","number":"03-1234-5678"}],"hobbies":[{"name":"サッカー","level":"中級"},{"name":"読書","genres":["フィクション","ノンフィクション","ミステリー"]},{"name":"料理","skills":{"cuisine":["和食","イタリアン"],"level":"上級"}}],"preferences":{"language":"日本語","notifications":{"email":true,"sms":false,"push":true}}}}'
var dummy = JSON.parse(jsonString);
eval('var dummy = ' + jsonString);