kennknowles / python-jsonpath-rw

A robust and significantly extended implementation of JSONPath for Python, with a clear AST for metaprogramming.
Apache License 2.0
603 stars 195 forks source link

Does the parser support exclamation character (`!`)? #79

Open xiaoyanqu opened 4 years ago

xiaoyanqu commented 4 years ago

Hi there, thanks so much for provide this awesome tool, i.e. jsonpath.

I'm working on parsing a parameter like parse("abcdefg!abcdefg").find(json_object), which contains the '!' character in one of the keys of json objects, then I got: raise JsonPathLexerError('Error on line %s, col %s: Unexpected character: %s ' % (t.lexer.lineno, t.lexpos - t.lexer.latest_newline, t.value[0])) jsonpath_ng.lexer.JsonPathLexerError: Error on line 1, col 29: Unexpected character: !

I was wondering is the exclamation character (!) currently supported by the parser? If so, can you please advise how shall I feed in?

Thanks!

mjallday commented 3 years ago

Similar question on the ? character.

$..routes[?(@.id==foo)].filters[0] results in "*** jsonpath_rw.lexer.JsonPathLexerError: Error on line 1, col 10: Unexpected character: ?"

This is a valid example according to https://goessner.net/articles/JsonPath/

image