Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

circular-json

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

circular-json

JSON does not handle circular references. This version does

  • 0.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.9M
increased by13.65%
Maintainers
1
Weekly downloads
 
Created

What is circular-json?

The circular-json npm package is designed to handle JSON serialization and deserialization of objects that contain circular references. This is particularly useful when working with complex data structures that would otherwise cause errors with the standard JSON.stringify and JSON.parse methods.

What are circular-json's main functionalities?

Stringify with Circular References

This feature allows you to convert an object with circular references into a JSON string without causing errors. The code sample demonstrates how to stringify an object that references itself.

const CircularJSON = require('circular-json');
const obj = {};
obj.self = obj;
const jsonString = CircularJSON.stringify(obj);
console.log(jsonString);

Parse with Circular References

This feature allows you to parse a JSON string that contains circular references back into an object. The code sample shows how to parse a JSON string that represents an object with a circular reference.

const CircularJSON = require('circular-json');
const jsonString = '{"self":"~"}';
const obj = CircularJSON.parse(jsonString);
console.log(obj);

Other packages similar to circular-json

Keywords

FAQs

Package last updated on 01 Aug 2016

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc