Filter expression with value from recursive descent

Setup

Selector: $[?(@..child)]

[{"key": [{"child": 1}, {"child": 2}]}, {"key": [{"child": 2}]}, {"key": [{}]}, {"key": [{"something": 42}]}, {}]

Results

Other responses

Bash (JSONPath.sh)

[]

C (json-glib)

Not supported

Unable to compile selector `$[?(@..child)]': Invalid array index definition “?(@..child)]”

Clojure (json-path) ¹

[]

Cpp (jsoncons)

[
  {
    "key": [
      {
        "child": 1
      },
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {
        "child": 2
      }
    ]
  }
]

Dart (json_path)

[
  {
    "key": [
      {
        "child": 1
      },
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {
        "child": 2
      }
    ]
  }
]

Elixir (ExJsonPath)

Not supported

syntax error before: ')'

Elixir (jaxon)

[]

Elixir (warpath) ¹

Not supported

Parser error: Invalid token on line 1, syntax error before: <<"..">>

Erlang (ejsonpath)

[
  {
    "key": [
      {
        "child": 1
      },
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {
        "child": 2
      }
    ]
  }
]

Golang (github.com-PaesslerAG-jsonpath) ¹

[]

Golang (github.com-bhmj-jsonslice) ¹ ³

[
  {
    "key": [
      {
        "child": 1
      },
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {}
    ]
  },
  {
    "key": [
      {
        "something": 42
      }
    ]
  },
  {}
]

Golang (github.com-ohler55-ojg)

[]

Golang (github.com-oliveagle-jsonpath) ¹

[]

Golang (github.com-spyzhov-ajson)

[
  {
    "key": [
      {
        "child": 1
      },
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {
        "child": 2
      }
    ]
  }
]

Golang (github.com-vmware-labs-yaml-jsonpath)

Not supported

missing end of filter at position 14, following "..child)]"

Haskell (jsonpath)

Not supported

Invalid JSONPath: $[?(@..child)]
 Error: 1:7:
  |
1 | $[?(@..child)]
  |       ^
unexpected '.'
expecting "!=", "&&", "<=", "==", ">=", "||", '!', ')', '<', '>', or white space

JavaScript (brunerd)

Not supported

JavaScript (jsonpathly)

[
  {
    "key": [
      {
        "child": 1
      },
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {}
    ]
  },
  {
    "key": [
      {
        "something": 42
      }
    ]
  },
  {}
]

Java (com.github.jsurfer)

[]

Java (com.jayway.jsonpath) ¹ ³

[
  {
    "key": [
      {
        "child": 1
      },
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {}
    ]
  },
  {
    "key": [
      {
        "something": 42
      }
    ]
  },
  {}
]

Kotlin (com.nfeld.jsonpathkt) ¹

Not supported

Unexpected char, char=?, index=2

Objective-C (SMJJSONPath) ¹ ³

[
  {
    "key": [
      {
        "child": 1
      },
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {}
    ]
  },
  {
    "key": [
      {
        "something": 42
      }
    ]
  },
  {}
]

PHP (galbar-jsonpath)

[
  {
    "key": [
      {
        "child": 1
      },
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {
        "child": 2
      }
    ]
  }
]

PHP (remorhaz-jsonpath)

[
  {
    "key": [
      {
        "child": 1
      },
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {
        "child": 2
      }
    ]
  }
]

PHP (softcreatr-jsonpath)

[]

Python (jsonpath) ²

Not found

jsonpath returned false, this might indicate an error

Python (jsonpath-ng)

Not supported

JsonPathLexerError('Error on line 1, col 2: Unexpected character: ? ')

Python (jsonpath-rw)

Not supported

JsonPathLexerError('Error on line 1, col 2: Unexpected character: ? ')

Python (jsonpath2)

[
  [
    {
      "key": [
        {
          "child": 1
        },
        {
          "child": 2
        }
      ]
    },
    {
      "key": [
        {
          "child": 2
        }
      ]
    },
    {
      "key": [
        {}
      ]
    },
    {
      "key": [
        {
          "something": 42
        }
      ]
    },
    {}
  ]
]

Python (python-jsonpath)

[
  {
    "key": [
      {
        "child": 1
      },
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {
        "child": 2
      }
    ]
  }
]

Raku (JSON-Path)

Not supported

Evaluation of embedded Perl 6 code not allowed (construct with :allow-eval)

Ruby (jsonpath)

[
  {
    "key": [
      {
        "child": 1
      },
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {}
    ]
  },
  {
    "key": [
      {
        "something": 42
      }
    ]
  },
  {}
]

Rust (jsonpath)

Not supported

parsing error

Rust (jsonpath_lib)

[
  {
    "child": 1
  },
  {
    "child": 2
  },
  {
    "child": 2
  }
]

Rust (jsonpath_plus)

[]

Rust (serde_json_path)

[
  {
    "key": [
      {
        "child": 1
      },
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {
        "child": 2
      }
    ]
  }
]

Scala (jsonpath)

[
  {
    "key": [
      {
        "child": 1
      },
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {
        "child": 2
      }
    ]
  }
]

Swift (Sextant)

[
  {
    "key": [
      {
        "child": 1
      },
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {}
    ]
  },
  {
    "key": [
      {
        "something": 42
      }
    ]
  },
  {}
]

dotNET (Json.NET)

[
  {
    "key": [
      {
        "child": 1
      },
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {
        "child": 2
      }
    ]
  }
]

dotNET (JsonCons.JsonPath)

[
  {
    "key": [
      {
        "child": 1
      },
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {
        "child": 2
      }
    ]
  }
]

dotNET (JsonPath.Net)

[
  {
    "key": [
      {
        "child": 1
      },
      {
        "child": 2
      }
    ]
  },
  {
    "key": [
      {
        "child": 2
      }
    ]
  }
]

dotNET (Manatee.Json)

Not supported

The method or operation is not implemented.

Errors

JavaScript (Goessner) ²

jsonPath: Unexpected token .: _v..child

JavaScript (jsonpath)

Line 1: Unexpected token .

JavaScript (jsonpath-plus)

Unexpected token '.'

PHP (Goessner) ²

ArgumentCountError

Perl (JSON-Path)

non-safe evaluation, died at main.pl line 11.

dotNET (JsonPathLib)

Line 1: Unexpected token .

Footnotes