Converts MongoDB Extended JSON Strict Mode syntax to JavaScript Mode, allowing use of Date, RegExp, and undefined in MongoDB query objects directly. Version 2.0.0 is the latest stable release, updated infrequently. Unlike manual parsing, it handles nested objects and all extended JSON types ($date, $regex, $undefined) automatically, converting to native JavaScript Date, RegExp, and undefined values.
npm install json2mongoNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Converts MongoDB Extended JSON Strict Mode with $date, $undefined, $regex to native JavaScript types.
Add declare module 'json2mongo' in a .d.ts file or install @types/json2mongo.
Clone the input before passing if the original is needed: const cloned = JSON.parse(JSON.stringify(original));
If the property must persist, consider omitting $undefined or post-process the result.
Use const json2mongo = require('json2mongo') or enable esModuleInterop in TypeScript.Create a global .d.ts file with declare module 'json2mongo'; or use require style.
No dependency data recorded yet.