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

json-refs

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-refs

Various utilities for JSON References (http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03).

  • 3.0.12
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
211K
decreased by-79.78%
Maintainers
1
Weekly downloads
 
Created

What is json-refs?

The json-refs npm package is a utility for working with JSON references, which are pointers within JSON objects that reference other parts of the JSON document. It helps resolve these references and can be used to make JSON documents easier to understand and manipulate by consolidating linked data.

What are json-refs's main functionalities?

Resolving JSON References

This feature allows the resolution of JSON references within a JSON document. The code sample demonstrates how to resolve references in a JSON file located at a specified path, with an option to resolve circular references.

{
  "jsonRefs": require('json-refs'),
  "path": './somePath/to/json',
  "options": { resolveCirculars: true },
  "resolvedJson": function() {
    var root = jsonRefs.resolveRefsAt(this.path, this.options).then(function (results) {
      console.log(results.resolved);
    }).catch(function (err) {
      console.error(err.stack);
    });
    return root;
  }
}

Finding JSON References

This feature involves identifying all the JSON references in a given JSON object. The code sample shows how to find all references, including those that might be invalid, within a JSON object.

{
  "jsonRefs": require('json-refs'),
  "jsonObject": { /* some JSON object */ },
  "options": { includeInvalid: true },
  "foundRefs": function() {
    var refs = jsonRefs.findRefs(this.jsonObject, this.options);
    console.log(refs);
    return refs;
  }
}

Other packages similar to json-refs

Keywords

FAQs

Package last updated on 05 Oct 2018

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