Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2022.1.3\plugins\python\helpers\pydev\pydevd.py", line 1496, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files\JetBrains\PyCharm 2022.1.3\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:\project\extras\test_jsonpath.py", line 33, in <module>
parsed_jsonpath: JSONPath = parse(EXPRESSION)
File "C:\project\venv\lib\site-packages\jsonpath_ng\ext\parser.py", line 172, in parse
return ExtentedJsonPathParser(debug=debug).parse(path)
File "C:\project\venv\lib\site-packages\jsonpath_ng\parser.py", line 44, in parse
return self.parse_token_stream(lexer.tokenize(string))
File "C:\project\venv\lib\site-packages\jsonpath_ng\parser.py", line 67, in parse_token_stream
return new_parser.parse(lexer = IteratorToTokenStream(token_iterator))
File "C:\project\venv\lib\site-packages\ply\yacc.py", line 333, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "C:\project\venv\lib\site-packages\ply\yacc.py", line 1201, in parseopt_notrack
tok = call_errorfunc(self.errorfunc, errtoken, self)
File "C:\project\venv\lib\site-packages\ply\yacc.py", line 192, in call_errorfunc
r = errorfunc(token)
File "C:\project\venv\lib\site-packages\jsonpath_ng\parser.py", line 81, in p_error
raise JsonPathParserError('Parse error at %s:%s near token %s (%s)'
jsonpath_ng.exceptions.JsonPathParserError: Parse error at 1:23 near token ? (?)
python-BaseException
If jsonpath_ng doesn't support the expression $..[successes,errors]..?(typeof @ ==='string') as given, what should I do in order to achieve the same result?
I've composed and tested this expression in jsonpath.com:
$..[successes,errors]..?(typeof @ ==='string')
input data:
However, when running the python equivalent below (Python 3.10.9, jsonpath-ng==1.5.3):
I get the following exception:
If jsonpath_ng doesn't support the expression
$..[successes,errors]..?(typeof @ ==='string')
as given, what should I do in order to achieve the same result?