使用JsonPath读取嵌套数组属性

问题描述

[
  {
    "path": "test","resources": [
      {
        "name": "testfile"
      }
    ]
  },{
    "path": "test-1","resources": [
      {
        "name": "testfile-1"
      }
    ]
  }
]

给出与上述类似的json,是否可以使用jsonPath以以下格式读取它?

[
  {
    "path": "test","name": "testfile"
  },"name": "testfile-1"
  }
]

可以安全地假设资源数组的大小始终为1。

我尝试了$.[*]['path',['resources'][0]['name']],但是它没有显示path的值。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)