jmespath.site
jmespath.site copied to clipboard
filter on key containing special character
Data Structure
{
"objects": [
{
"@TYPE": A,
"$": "one",
},
{
"@TYPE": B,
"$": "two",
},
{
"@TYPE": C,
"$": "three",
}
]
}
Question
I am trying to write a query that will return "one". I have tried the following:
objects[?@TYPE == "A"]."$" this is a syntax error
objects[?"@TYPE" == "A"]."$" this returns an empty array
objects[?"\@TYPE" == "A"]."$" this is a syntax error
objects[?"/@TYPE" == "A"]."$" this returns ["one", "two", "three"] which is a surprise...
What is the proper way to escape the @ in the key name?