1.0.0 • Published 10 years ago

json-pointer.js v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

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');