小编use*_*243的帖子

使用字符串过滤 JMESPath

尽管进行了大量研究,我还是找不到解决方案。我被 contains 函数困住了。我有这个 Json 文件:

    {
  "from": "Api",
  "success": true,
  "message": "",
  "errors": [],
  "data": {
    "operations": [
      {
        "IDOperation": 100,
        "DateEcriture": "2019-01-02",
        "Comment": "Invoice Nh5 numero 152",
        "sous_operations": []
      },
      {
        "IDOperation": 101,
        "DateEcriture": "2019-01-02",
        "Comment": "one other thing",
        "sous_operations": []
      },
      {
        "IDOperation":102,
        "DateEcriture": "2019-01-02",
        "Comment": "an other thing",
        "sous_operations": [{"ID-sous-Operation": 103,
                           "DateEcriture": "2019-01-02",
                           "Comment": "Invoice Nh15 numero 341"}]
      }]
   } 
}
Run Code Online (Sandbox Code Playgroud)

我想过滤“注释”字段中包含“发票”一词的对象以获得以下结果:

{"operations": [
      {
        "IDOperation": 100,
        "DateEcriture": "2019-01-02",
        "Comment": "Invoice Nh5 numero 152"
      },
      {
        "IDOperation": …
Run Code Online (Sandbox Code Playgroud)

search json substring contains jmespath

2
推荐指数
1
解决办法
3559
查看次数

标签 统计

contains ×1

jmespath ×1

json ×1

search ×1

substring ×1