Skip to content
/ jref Public

Resolve JSON pointers and dereference JSON schemas

Notifications You must be signed in to change notification settings

left-rite/jref

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jref

Description

jref traverse and dereference JSON objects quickly.

  • Currently only support internal references.
  • No dependencies.

Installation

npm install jref

Example

var jref = require('jref');

var object = {
  a: {
    b: {
      c: {
        $ref: '#/alphabet/c'
      }
    }
  },
  alphabet: {
    c: {
      soundsLike: 'see',
      one: 'stroke',
      is: 'curved'
    }
  }
};

jref.traverse(object, '#/alphabet/c');
// {
//   soundsLike: 'see',
//   one: 'stroke',
//   is: 'curved'
// }

jref.dereference(object);
// {
//   a: {
//     b: {
//       c: {
//       soundsLike: 'see',
//       one: 'stroke',
//       is: 'curved'
//     }
//   },
//   alphabet: {
//     c: {
//       soundsLike: 'see',
//       one: 'stroke',
//       is: 'curved'
//     }
//   }
// }

About

Resolve JSON pointers and dereference JSON schemas

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published