json-pointer.js
v1.0.0
Published
JSON pointer
Downloads
3
Readme
json-pointer.js
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');