Parse JSON in JavaScript? [duplicate] Parse JSON in JavaScript? [duplicate] javascript javascript

Parse JSON in JavaScript? [duplicate]


The standard way to parse JSON in JavaScript is JSON.parse()

The JSON API was introduced with ES5 (2011) and has since been implemented in >99% of browsers by market share, and Node.js. Its usage is simple:

const json = '{ "fruit": "pineapple", "fingers": 10 }';const obj = JSON.parse(json);console.log(obj.fruit, obj.fingers);