在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:janl/node-jsonpointer开源软件地址:https://github.com/janl/node-jsonpointer开源编程语言:JavaScript 100.0%开源软件介绍:JSON Pointer for Node.jsThis is an implementation of JSON Pointer. CLILooking to filter JSON from the command line? Check out jsonpointer-cli. Usagevar jsonpointer = require('jsonpointer');
var obj = { foo: 1, bar: { baz: 2}, qux: [3, 4, 5]};
jsonpointer.get(obj, '/foo'); // returns 1
jsonpointer.get(obj, '/bar/baz'); // returns 2
jsonpointer.get(obj, '/qux/0'); // returns 3
jsonpointer.get(obj, '/qux/1'); // returns 4
jsonpointer.get(obj, '/qux/2'); // returns 5
jsonpointer.get(obj, '/quo'); // returns undefined
jsonpointer.set(obj, '/foo', 6); // sets obj.foo = 6;
jsonpointer.set(obj, '/qux/-', 6) // sets obj.qux = [3, 4, 5, 6]
var pointer = jsonpointer.compile('/foo')
pointer.get(obj) // returns 1
pointer.set(obj, 1) // sets obj.foo = 1 Testing
Author(c) 2011-2021 Jan Lehnardt [email protected] & Marc Bachmann https://github.com/marcbachmann Thanks to all contributors. LicenseMIT License. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论