mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
864 B
33 lines
864 B
10 years ago
|
# JSON Pointer for nodejs
|
||
|
|
||
|
This is an implementation of [JSON Pointer](http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-08).
|
||
|
|
||
|
## Usage
|
||
|
|
||
|
var jsonpointer = require("jsonpointer");
|
||
|
var obj = { foo: 1, bar: { baz: 2}, qux: [3, 4, 5]};
|
||
|
var one = jsonpointer.get(obj, "/foo");
|
||
|
var two = jsonpointer.get(obj, "/bar/baz");
|
||
|
var three = jsonpointer.get(obj, "/qux/0");
|
||
|
var four = jsonpointer.get(obj, "/qux/1");
|
||
|
var five = jsonpointer.get(obj, "/qux/2");
|
||
9 years ago
|
var notfound = jsonpointer.get(obj, "/quo"); // returns null
|
||
10 years ago
|
|
||
|
jsonpointer.set(obj, "/foo", 6); // obj.foo = 6;
|
||
|
|
||
|
## Testing
|
||
|
|
||
|
$ node test.js
|
||
|
All tests pass.
|
||
|
$
|
||
|
|
||
9 years ago
|
[![Build Status](https://travis-ci.org/janl/node-jsonpointer.png?branch=master)](https://travis-ci.org/janl/node-jsonpointer)
|
||
10 years ago
|
|
||
|
## Author
|
||
|
|
||
|
(c) 2011 Jan Lehnardt <jan@apache.org>
|
||
|
|
||
|
## License
|
||
|
|
||
9 years ago
|
MIT License.
|