You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importjsonfromjsonpath_ngimportjsonpath, parseimportjsonpath_ng.ext.arithmetic# Example JSON datajson_data='''{ "Keys": [ {"Format": "A", "Subtype": "A1"}, {"Format": "A", "Subtype": "A2"}, {"Format": "B", "Subtype": "A1"} ]}'''# Parse the JSON datadata=json.loads(json_data)
# Define the JsonPath expressionexpression=parse("$.concat($.Keys[0].Format, $.Keys[0].Subtype)")
**# wanted to get AA1**# Evaluate the expression for the first elementresult= [match.valueformatchinexpression.find(data)]
print("Concatenated value for the first element:", result[0])
The text was updated successfully, but these errors were encountered:
michaelmior
changed the title
wanted the example of arithmetic expresion
Wanted an example of arithmetic expressions
Jun 11, 2024
The text was updated successfully, but these errors were encountered: