I am using jmespath to search a snippet of JSON, and one of the JSON keys contains an '@' symbol. Since the '@' symbol is a reserved character, jmespath chokes. I have tried a number of things to escape the '@' symbol unsuccessfully. How do I escape the '@' symbol in my jmespath search?
Example:
json = {"@name": "Bob", "address": "123 Main St"}
jmespath.search("@name", json)
Error message:
{ParseError} Unexpected token: name: Parse error at column 1, token "name" (UNQUOTED_IDENTIFIER), for expression: "@name" ^
I have also tried the following variations for the above jmespath query, with the same error:
jmespath.search("!@name", json)
jmespath.search("\@name", json)
jmespath.search("`@`name", json)
jmespath.search("\"@\"name", json)