Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON path parser fails to parse comma-separated array indexes #169

Open
aovchinnikov opened this issue May 2, 2024 · 0 comments
Open

JSON path parser fails to parse comma-separated array indexes #169

aovchinnikov opened this issue May 2, 2024 · 0 comments

Comments

@aovchinnikov
Copy link

aovchinnikov commented May 2, 2024

Env:

  • Windows 10
  • Python 3.8.10
  • jsonpath-ng 1.6.1

The following code returns parser error:

from jsonpath_ng.ext import parse

jsonpath_expr = parse('$.commands[0,1].test_prop')

jsonpath_expr = parse('$.commands[0,1].tester') File "C:\Python38\lib\site-packages\jsonpath_ng\ext\parser.py", line 174, in parse return ExtentedJsonPathParser(debug=debug).parse(path) File "C:\Python38\lib\site-packages\jsonpath_ng\parser.py", line 38, in parse return self.parse_token_stream(lexer.tokenize(string)) File "C:\Python38\lib\site-packages\jsonpath_ng\parser.py", line 62, in parse_token_stream return new_parser.parse(lexer = IteratorToTokenStream(token_iterator)) File "C:\Python38\lib\site-packages\ply\yacc.py", line 333, in parse return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc) File "C:\Python38\lib\site-packages\ply\yacc.py", line 1201, in parseopt_notrack tok = call_errorfunc(self.errorfunc, errtoken, self) File "C:\Python38\lib\site-packages\ply\yacc.py", line 192, in call_errorfunc r = errorfunc(token) File "C:\Python38\lib\site-packages\jsonpath_ng\parser.py", line 78, in p_error raise JsonPathParserError('Parse error at %s:%s near token %s (%s)' jsonpath_ng.exceptions.JsonPathParserError: Parse error at 1:12 near token , (,)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant