jmespath / jmespath.py

JMESPath is a query language for JSON.

Home Page:http://jmespath.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node names cannot contain special signs

Semtexcz opened this issue · comments

Node cannot contain special signs.
If the name of the node contain @, - or other signs the program raise jmespath.exceptions.LexerError: Bad jmespath expression: Unknown token '-':.
Is it bug or does exist some solution for the problem?
The restraint practically not allow using BadgerFish convention for parsing JSON that come from XML.

I also had problem with node names containing dash sign '-'.
workaround : wrap your node with quotes.

For example:
data[?"is-home-region"]."region-name"

Yes, if your identifier isn't [a-zA-Z0-9_]+ then you have to quote it. Otherwise it would be ambiguous with the other parts of the grammar. This is described in the section on identifiers, specifically the parts about quoted vs. unquoted identifiers.

Let me know if you have any other questions.

That being said, it would be awesome if there were better error messages when this happened.