Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/web_bson/src/extended_json.ts>parse

web_bson is a fork from mongodb/js-bson
Very Popular
Go to Latest
function parse
import { parse } from "https://deno.land/x/web_bson@v0.2.5/src/extended_json.ts";

Parse an Extended JSON string, constructing the JavaScript value or object described by that string.

Examples

Example 1

const { EJSON } = require('bson');
const text = '{ "int32": { "$numberInt": "10" } }';

// prints { int32: { [String: '10'] _bsontype: 'Int32', value: '10' } }
console.log(parse(text, { relaxed: false }));

// prints { int32: 10 }
console.log(parse(text));

Parameters

text: string
optional
options: Options