美文网首页
jsonpath使用

jsonpath使用

作者: 苏苡 | 来源:发表于2023-11-05 14:42 被阅读0次
1. 安装
npm install jsonpath
2. 使用
1. 使用页面引入:
  var jp = require('jsonpath');

2. 已存在的数据Object: 
const Object = {
  a.b.c.d: '11111'
}
3. newName   list 结构组装的name:
const newName= 'a.b.c.d'

4. 使用方法:
var names = jp.query(Object, `$.${newName}`);

相关文章

网友评论

      本文标题:jsonpath使用

      本文链接:https://www.haomeiwen.com/subject/luwzidtx.html