Filter expression with equals false
Setup
Selector: $[?(@.key==false)]
[
{
"some": "some value"
},
{
"key": true
},
{
"key": false
},
{
"key": null
},
{
"key": "value"
},
{
"key": ""
},
{
"key": 0
},
{
"key": 1
},
{
"key": -1
},
{
"key": 42
},
{
"key": {}
},
{
"key": []
}
]
Results
Other responses
Bash (JSONPath.sh)
[
false
]
C (json-glib)
Not supported
Unable to compile selector `$[?(@.key==false)]': Invalid array index definition “?(@.key==false)]”
Clojure (json-path)
¹
[
{
"some": "some value"
},
{
"key": null
}
]
Cpp (jsoncons)
[
{
"key": false
}
]
Dart (json_path)
[
{
"key": false
}
]
Elixir (ExJsonPath)
Not supported
syntax error before: <<"false">>
Elixir (jaxon)
[]
Elixir (warpath)
¹
[
{
"key": false
}
]
Erlang (ejsonpath)
Not supported
syntax error before: ')'
[
{
"key": false
}
]
[
{
"key": false
},
{
"key": ""
},
{
"key": 0
}
]
[
{
"key": false
}
]
[]
[
{
"key": false
}
]
[
{
"key": false
}
]
Haskell (jsonpath)
[
{
"key": false
}
]
JavaScript (Goessner)
²
[
{
"key": false
},
{
"key": ""
},
{
"key": 0
},
{
"key": []
}
]
JavaScript (brunerd)
[
{
"key": false
}
]
JavaScript (jsonpath)
[
{
"key": false
},
{
"key": ""
},
{
"key": 0
},
{
"key": []
}
]
JavaScript (jsonpath-plus)
[
{
"key": false
},
{
"key": ""
},
{
"key": 0
},
{
"key": []
}
]
JavaScript (jsonpathly)
[
{
"key": false
}
]
Java (com.github.jsurfer)
[
{
"key": false
}
]
Java (com.jayway.jsonpath)
¹
³
[
{
"key": false
}
]
Kotlin (com.nfeld.jsonpathkt)
¹
Not supported
Unexpected char, char=?, index=2
Objective-C (SMJJSONPath)
¹
³
[
{
"key": false
},
{
"key": 0
}
]
PHP (galbar-jsonpath)
[
{
"some": "some value"
},
{
"key": false
}
]
PHP (remorhaz-jsonpath)
[
{
"key": false
}
]
PHP (softcreatr-jsonpath)
[
{
"key": false
},
{
"key": null
},
{
"key": ""
},
{
"key": 0
},
{
"key": []
}
]
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)
Not supported
line 1:10 extraneous input '=' expecting {'@', '$', 'true', 'false', 'null', '{', '[', STRING, NUMBER}
ValueError("line 1:10 extraneous input '=' expecting {'@', '$', 'true', 'false', 'null', '{', '[', STRING, NUMBER}")
Python (python-jsonpath)
[
{
"key": false
},
{
"key": 0
}
]
Raku (JSON-Path)
Not supported
Evaluation of embedded Perl 6 code not allowed (construct with :allow-eval)
Ruby (jsonpath)
[
{
"key": false
}
]
Rust (jsonpath)
Not supported
parsing error
Rust (jsonpath_lib)
[
{
"key": false
}
]
Rust (jsonpath_plus)
[
{
"key": false
}
]
Rust (serde_json_path)
[
{
"key": false
}
]
Scala (jsonpath)
[
{
"key": false
}
]
Swift (Sextant)
[
{
"key": false
},
{
"key": 0
}
]
dotNET (Json.NET)
[
{
"key": false
}
]
dotNET (JsonCons.JsonPath)
[
{
"key": false
}
]
dotNET (JsonPath.Net)
[
{
"key": false
}
]
dotNET (Manatee.Json)
[
{
"some": "some value"
},
{
"key": false
}
]
Errors
PHP (Goessner)
²
ArgumentCountError
Perl (JSON-Path)
non-safe evaluation, died at main.pl line 11.
dotNET (JsonPathLib)
Accessed JArray values with invalid key value: "valueOf". Int32 array index expected.
Footnotes
- ¹ This implementation returns a single value where only one match is possible (instead of an array of a single value).
- ² This implementation returns a specific not found value if no match exists.
- ³ This implementation returns a specific not found value if a query that would regularly return a single match results in no match.