Tikhon Jelvis Tikhon Jelvis - 2 years ago 123
JSON Question

How to parse JSON using Node.js?

How should I parse JSON using Node.js? Is there some module which will validate and parse JSON securely?

Answer Source

You can simply use JSON.parse.

node.js is built on V8, which provides the global object JSON[docs]. The definition of the JSON object is part of the ECMAScript 5 specification.

Note - JSON.parse can tie up the current thread because it is a synchronous method. So if you are planning to parse big JSON objects use a streaming json parser.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download