I'm trying to use JSONPath ( https://github.com/jayway/JsonPath ) to search a document which has spaces in the field names:
{
"model": {
"Details": {
"Nospace": "New today",
"Random nonsense": "New today"
}
}
}
I'm testing using the evaluator at http://jsonpath.herokuapp.com/
This works:
$.model.Details[?(@.Nospace== 'New today')]
But this does not:
$.model.Details[?(@.'Random nonsense'== 'New today')]
This does but is missing the filter expression:
$.model.Details['Random nonsense']
So it seems it's possible to refer to fields with spaces, but I haven't found how to use them in a filter. Is it possible? I have tried many other combinations with no luck, and don't seem to find anything online about it either.
Thanks.
额外的括号。
$.model.Details[?(@['Random nonsense'] == 'New today')]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.