Filter expression with equals number with fraction
Setup
Selector: $[?(@.key==-0.123e2)]
[{"key": -12.3}, {"key": -0.123}, {"key": -12}, {"key": 12.3}, {"key": 2}, {"key": "-0.123e2"}]
Results
Other responses
Bash (JSONPath.sh)
[
"-0.123e2"
]
C (json-glib)
Not supported
Unable to compile selector `$[?(@.key==-0.123e2)]': Invalid array index definition “?(@.key==-0.123e2)]”
Clojure (json-path)
¹
[]
Cpp (jsoncons)
[
{
"key": -12.3
}
]
Dart (json_path)
Not supported
end of input expected at 1:2
Elixir (ExJsonPath)
Not supported
syntax error before: '.'
Elixir (jaxon)
[]
Elixir (warpath)
¹
[
{
"key": -12.3
}
]
Erlang (ejsonpath)
Not supported
syntax error before: '-'
[
{
"key": -12.3
}
]
[
{
"key": -12.3
},
{
"key": "-0.123e2"
}
]
Not supported
[]
[
{
"key": -12.3
}
]
[
{
"key": -12.3
}
]
Haskell (jsonpath)
Not supported
Invalid JSONPath: $[?(@.key==-0.123e2)]
Error: 1:12:
|
1 | $[?(@.key==-0.123e2)]
| ^^^^^
unexpected "-0.12"
expecting "false", "null", "true", '!', '"', '$', ''', '@', digit, or white space
JavaScript (Goessner)
²
[
{
"key": -12.3
},
{
"key": "-0.123e2"
}
]
JavaScript (brunerd)
[
{
"key": -12.3
}
]
JavaScript (jsonpath)
[
{
"key": -12.3
},
{
"key": "-0.123e2"
}
]
JavaScript (jsonpath-plus)
[
{
"key": -12.3
},
{
"key": "-0.123e2"
}
]
Java (com.jayway.jsonpath)
¹
³
[
{
"key": -12.3
}
]
Kotlin (com.nfeld.jsonpathkt)
¹
Not supported
Unexpected char, char=?, index=2
Objective-C (SMJJSONPath)
¹
³
Not supported
Expected character ')' but found 'e'
PHP (galbar-jsonpath)
[
{
"key": -12.3
}
]
PHP (remorhaz-jsonpath)
Not supported
Error: 'Failed to build AST from JSONPath query: $[?(@.key==-0.123e2)]'
PHP (softcreatr-jsonpath)
[
{
"key": -12.3
},
{
"key": "-0.123e2"
}
]
Python (jsonpath)
²
[
{
"key": -12.3
}
]
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}")
Raku (JSON-Path)
Not supported
Evaluation of embedded Perl 6 code not allowed (construct with :allow-eval)
Ruby (jsonpath)
[
{
"key": -12.3
},
{
"key": -0.123
},
{
"key": -12
},
{
"key": 12.3
},
{
"key": 2
},
{
"key": "-0.123e2"
}
]
Rust (jsonpath)
Not supported
parsing error
Rust (jsonpath_lib)
[
{
"key": -12.3
}
]
Scala (jsonpath)
Not supported
JPError(end of input expected)
Swift (Sextant)
Not supported
NOT_SUPPORTED
dotNET (Json.NET)
[
{
"key": -12.3
}
]
dotNET (JsonCons.JsonPath)
[
{
"key": -12.3
}
]
dotNET (JsonPath.Net)
[
{
"key": -12.3
}
]
dotNET (JsonPathLib)
[
{
"key": -12.3
},
{
"key": "-0.123e2"
}
]
dotNET (Manatee.Json)
[
{
"key": -12.3
}
]
JSON (Path_Reference_Implementation)
Not supported
--> 1:3
|
1 | $[?(@.key==-0.123e2)]
| ^---
|
= expected unionChild, unionArrayIndex, or sliceStart
Proposal (A)
[
{
"key": -12.3
}
]
Errors
Java (com.github.jsurfer)
java.lang.NumberFormatException: Character " is neither a decimal digit number, decimal point, nor "e" notation exponential mark.
PHP (Goessner)
²
ArgumentCountError
Perl (JSON-Path)
non-safe evaluation, died at main.pl line 11.
Rust (jsonpath_plus)
Error Parsing JSON Path:
$[?(@.key==-0.123e2)]
panic occurred
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.