We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I've got the following Error:
jsonpath_ng.exceptions.JsonPathParserError: Parse error at 1:2 near token 1 (NUMBER)
I tried a lot, and it only raises, when Objectag only contains Numbers. I tried it with parsing / finding Data and Editing Data. Both raises Error.
Example Code:
`import json from jsonpath_ng import jsonpath, parse
def jsonparser(Path, Json): json_data = json.loads(Json) jsonpath_expression = parse(Path) Output = jsonpath_expression.find(json_data)[0].value return Output
def jsonEditvalue(Path, Json, Value): json_data = json.loads(Json) jsonpath_expr = parse(Path) jsonpath_expr.find(json_data) jsonpath_expr.update(json_data, Value) Output = json.dumps(json_data, indent=2) return Output
jsonstring = """ { "1" : { "One" : "Data1", "Two" : "Data2", "Three" : "Data3" }, "2" : { "One" : "Data1", "Two" : "Data2", "Three" : "Data3" } } """ print(jsonparser("$.1.One", jsonstring)) print(jsonEditvalue("$.1.One", jsonstring, "DataNew")) ` jsonpath-ng is the first Parser I used with that Kind of Issue.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I've got the following Error:
I tried a lot, and it only raises, when Objectag only contains Numbers. I tried it with parsing / finding Data and Editing Data. Both raises Error.
Example Code:
`import json
from jsonpath_ng import jsonpath, parse
def jsonparser(Path, Json):
json_data = json.loads(Json)
jsonpath_expression = parse(Path)
Output = jsonpath_expression.find(json_data)[0].value
return Output
def jsonEditvalue(Path, Json, Value):
json_data = json.loads(Json)
jsonpath_expr = parse(Path)
jsonpath_expr.find(json_data)
jsonpath_expr.update(json_data, Value)
Output = json.dumps(json_data, indent=2)
return Output
jsonstring = """
{
"1" : {
"One" : "Data1",
"Two" : "Data2",
"Three" : "Data3"
},
"2" : {
"One" : "Data1",
"Two" : "Data2",
"Three" : "Data3"
}
}
"""
print(jsonparser("$.1.One", jsonstring))
print(jsonEditvalue("$.1.One", jsonstring, "DataNew"))
`
jsonpath-ng is the first Parser I used with that Kind of Issue.
The text was updated successfully, but these errors were encountered: