json-pointer.js

1.0.0 • Public • Published

json-pointer.js

build status

var doc = {
  "foo": "bar"
};

Find

jsonpointer.find(doc, '/foo');
// returns 'bar'

Has

jsonpointer.has(doc, '/foo');
// returns true

Set

jsonpointer.set(doc, '/hello', 'world');
// adds {"hello": "world"} to doc

Remove

jsonpointer.remove(doc, '/foo');
// deletes "foo" property from doc and returns its value "bar"

Parse

jsonpointer.parse('/foo/bar/hello');
// returns ['foo', 'bar', 'hello'];

Serialize

jsonpointer.serialize(['foo', 'bar', 'hello']);
// returns ('/foo/bar/hello');

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i json-pointer.js

      Weekly Downloads

      2

      Version

      1.0.0

      License

      MIT

      Last publish

      Collaborators

      • sonny