I have a JSON object in which I wish to retrieve the value of a property that contains a dot in its name using JMESPath:
{
"a": {
"b.c": "value"
}
}
In this example I wish to retrieve value. How can I achieve this?
I have a JSON object in which I wish to retrieve the value of a property that contains a dot in its name using JMESPath:
{
"a": {
"b.c": "value"
}
}
In this example I wish to retrieve value. How can I achieve this?
I just figured it out. I'm working in python, but I think the solution is the same for any implementation. Basically, any key name with special characters need to be quoted within the search string. With your example:
import jmespath
test_dictionary = {
"a": {
"b.c": "value"
}
}
jmespath.compile('a."b.c"').search(test_dictionary)
Result: 'value'
© 2022 - 2024 — McMap. All rights reserved.