Filter expression with negation and equals
Setup
Selector: $[?(!(@.key==42))]
[
{"key": 0},
{"key": 42},
{"key": -1},
{"key": 41},
{"key": 43},
{"key": 42.0001},
{"key": 41.9999},
{"key": 100},
{"key": "43"},
{"key": "42"},
{"key": "41"},
{"key": "value"},
{"some": "value"}
]
Results
Other responses
Bash (JSONPath.sh)
[]
C (json-glib)
Not supported
Unable to compile selector `$[?(!(@.key==42))]': Invalid array index definition “?(!(@.key==42))]”
Clojure (json-path)
¹
[
{
"key": 0
},
{
"key": 42
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "42"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
Cpp (jsoncons)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "42"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
Dart (json_path)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "42"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
Elixir (ExJsonPath)
Not supported
illegal characters "!("
Elixir (jaxon)
[]
Elixir (warpath)
¹
Not supported
Invalid syntax on line 1, {:illegal, '!('}
Not supported
parsing error: $[?(!(@.key==42))] :1:5 - 1:6 unexpected "!" while scanning extensions
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "42"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
[]
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "42"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
Haskell (jsonpath)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "42"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
JavaScript (Goessner)
²
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
JavaScript (brunerd)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "42"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
JavaScript (jsonpath)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
JavaScript (jsonpath-plus)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
JavaScript (jsonpathly)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "42"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
Java (com.github.jsurfer)
[
{
"key": 0
},
{
"key": 42
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "42"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
Java (com.jayway.jsonpath)
¹
³
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
Kotlin (com.nfeld.jsonpathkt)
¹
Not supported
Unexpected char, char=?, index=2
Objective-C (SMJJSONPath)
¹
³
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "41"
},
{
"key": "value"
}
]
PHP (galbar-jsonpath)
[
{
"key": 0
},
{
"key": 42
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "42"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
PHP (remorhaz-jsonpath)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "42"
},
{
"key": "41"
},
{
"key": "value"
}
]
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:4 token recognition error at: '!('
ValueError("line 1:4 token recognition error at: '!('")
Python (python-jsonpath)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "42"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
Raku (JSON-Path)
Not supported
Evaluation of embedded Perl 6 code not allowed (construct with :allow-eval)
Rust (jsonpath)
Not supported
parsing error
Rust (jsonpath_lib)
Not supported
path error:
$[?(!(@.key==42))]
^^^^
Rust (jsonpath_plus)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "42"
},
{
"key": "41"
},
{
"key": "value"
}
]
Rust (serde_json_path)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "42"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
Scala (jsonpath)
Not supported
JPError(end of input expected)
Swift (Sextant)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "41"
},
{
"key": "value"
}
]
dotNET (Json.NET)
Not supported
Unexpected character while parsing path query: !
dotNET (JsonCons.JsonPath)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "42"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
dotNET (JsonPath.Net)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "42"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
dotNET (JsonPathLib)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"key": "43"
},
{
"key": "41"
},
{
"key": "value"
},
{
"some": "value"
}
]
dotNET (Manatee.Json)
[
{
"key": 42
}
]
Errors
Erlang (ejsonpath)
Timeout
wrong symbol '!' at 2
PHP (Goessner)
²
ArgumentCountError
PHP (softcreatr-jsonpath)
Error: 'Malformed filter query'
Perl (JSON-Path)
non-safe evaluation, died at main.pl line 11.
Ruby (jsonpath)
wrong number of arguments (given 1, expected 0)
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.