chensenlai 10988628a0 语音房项目初始化 | %!s(int64=5) %!d(string=hai) anos | |
---|---|---|
.. | ||
.travis.yml | %!s(int64=5) %!d(string=hai) anos | |
README.md | %!s(int64=5) %!d(string=hai) anos | |
jsonpointer.js | %!s(int64=5) %!d(string=hai) anos | |
package.json | %!s(int64=5) %!d(string=hai) anos | |
test.js | %!s(int64=5) %!d(string=hai) anos |
This is an implementation of JSON Pointer.
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");
var notfound = jsonpointer.get(obj, "/quo"); // returns null
jsonpointer.set(obj, "/foo", 6); // obj.foo = 6;
$ node test.js
All tests pass.
$
(c) 2011 Jan Lehnardt jan@apache.org
MIT License.