I have a JSON file that I want to automatically check specific values,
like: myJSON['generic']['lessgeneric']['store']
should be equal to 100
,
I was thinking of doing something like this:
checks = [
{'name':'field_1','path':'myJSON['generic']['lessgeneric']['store']','value':'100'}
]
I have no clue how to convert the string "myJSON['generic']['lessgeneric']['store']"
into it's value.
edit: how I solved it
path = "generic>lessgeneric>store"
value = 100
def check_value(path,value):
temp_json = my_json
for key in path.split(">"):
temp_json = temp_json[key]
if temp_json == value:
pass