The question is simple. How to do a case-insensitive searching with JMESPath?
Let's say to search for foo in this JSON:
[
"foo",
"foobar",
"barfoo",
"bar",
"baz",
"barbaz",
"FOO"
]
Here is the case-sensitive search query:
[?contains(@, 'foo')]
It will returns ["foo", "foobar", "barfoo"] but it misses "FOO".
[?contains(lower(@), lower('string_you_want_to_search')]
We could convert both search strings into lower or upper case to get case insensitive search.
https://jmespath.site/#preview Latest preview has support for it.
JEP discussion https://github.com/jmespath-community/jmespath.spec/discussions/21
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With