I want to check is "Code":"A" avaiable in json file. I already searching on internet and read many QA in stackoverflow but it does not help me. Could anyone show me how to do it?
with open(dummyJson_url):
dataList = json.load(open(dummyJson_url))
test = json.loads("""{"Code":"A"}""")
racksLocation = dataList["Test"]
for i in range(len(racksLocation)):
newLoc = dataList["Test"][i]
if sorted(test.items()) in sorted(newLoc.items()):
print("Yes")
break
else:
print("No")
and here is my json:
{
"Test": [
{
"Code":"A",
"Buyer": []
},
{
"Code":"B",
"New": []
},
{
"Code":"C",
"Racks": []
},
{
"Code":"D",
"Baru": []
}
]
}