h2non / jsonpath-ng

Finally, a JSONPath implementation for Python that aims to be standard compliant. That's all. Enjoy!
Apache License 2.0
582 stars 85 forks source link

Exception: Parse error at 1:3 near token ] (]) #65

Open technigirl opened 3 years ago

technigirl commented 3 years ago

Hello,

When trying to enter the following as my jsonpath, I get the a parse error:

jsonpath_expr = parse('$.[]groupName,tabLabel')

This is a valid json expression, so it should work. I am trying to grab both of the two keys listed in the expression at once.

Is there another way to grab these two keys that will work with jsonpath-ng?

Error: Traceback (most recent call last): File "", line 1, in File "/Users/melissa.montanez/Library/Python/3.8/lib/python/site-packages/jsonpath_ng/parser.py", line 14, in parse return JsonPathParser().parse(string) File "/Users/melissa.montanez/Library/Python/3.8/lib/python/site-packages/jsonpath_ng/parser.py", line 32, in parse return self.parse_token_stream(lexer.tokenize(string)) File "/Users/melissa.montanez/Library/Python/3.8/lib/python/site-packages/jsonpath_ng/parser.py", line 55, in parse_token_stream return new_parser.parse(lexer = IteratorToTokenStream(token_iterator)) File "/Users/melissa.montanez/Library/Python/3.8/lib/python/site-packages/ply/yacc.py", line 333, in parse return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc) File "/Users/melissa.montanez/Library/Python/3.8/lib/python/site-packages/ply/yacc.py", line 1201, in parseopt_notrack tok = call_errorfunc(self.errorfunc, errtoken, self) File "/Users/melissa.montanez/Library/Python/3.8/lib/python/site-packages/ply/yacc.py", line 192, in call_errorfunc r = errorfunc(token) File "/Users/melissa.montanez/Library/Python/3.8/lib/python/site-packages/jsonpath_ng/parser.py", line 69, in p_error raise Exception('Parse error at %s:%s near token %s (%s)' % (t.lineno, t.col, t.value, t.type)) Exception: Parse error at 1:3 near token ] (])