Parse an Extended JSON string, constructing the JavaScript value or object described by that string.
const { EJSON } = require('bson');const text = '{ "int32": { "$numberInt": "10" } }';// prints { int32: { [String: '10'] _bsontype: 'Int32', value: '10' } }console.log(EJSON.parse(text, { relaxed: false }));// prints { int32: 10 }console.log(EJSON.parse(text)); Copy
const { EJSON } = require('bson');const text = '{ "int32": { "$numberInt": "10" } }';// prints { int32: { [String: '10'] _bsontype: 'Int32', value: '10' } }console.log(EJSON.parse(text, { relaxed: false }));// prints { int32: 10 }console.log(EJSON.parse(text));
Optional
Generated using TypeDoc
Parse an Extended JSON string, constructing the JavaScript value or object described by that string.
Example