🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

json-safe-stringify

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-safe-stringify

Stringify a Javascript JSON object, and actually handle Maps and Sets

1.0.3
latest
Source
npm
Version published
Weekly downloads
64
3.23%
Maintainers
1
Weekly downloads
 
Created
Source

json-safe-stringify

Example

const serializer = new JsonSerializer();
const text = serializer.stringify({ map: new Map([["a", 1]]) });
console.log(text);
const obj = serializer.parse(text, (error) => console.error(error));

Or use it directly

const text = JSON.stringify(
  { map: new Map([["a", 1]]) },
  jsonStringifyReplacer
);
console.log(text);
const obj = JSON.parse(text, (key, value) =>
  jsonParseReviver(key, value, (error) => console.error(error))
);

FAQs

Package last updated on 16 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts