Skip to content

Support implicit numeric conversions in filter expressions.#297

Open
kecaps wants to merge 1 commit intojson-path:masterfrom
kecaps:master
Open

Support implicit numeric conversions in filter expressions.#297
kecaps wants to merge 1 commit intojson-path:masterfrom
kecaps:master

Conversation

@kecaps
Copy link
Copy Markdown

@kecaps kecaps commented Jan 11, 2017

Javascript is not strongly typed, so it implicitly converts strings to numbers when comparing across data types:

# node
> "9" < 73
true
> 9 < "73"
true
> "9" < "73"
false

This adds functionality via a configuration option (IMPLICIT_NUMERIC_CONVERSIONS) to enable the java implementation of JsonPath to mimic this behavior. This behavior was already in place for equals, but this extends it to the other comparators.

@nycjoker
Copy link
Copy Markdown

nycjoker commented May 13, 2019

@kecaps / @kallestenflo Any reason this was never merged in? I'm running into a similar issue where a provider sends JSON values as all String values and I need to perform numeric filtering in Java.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants