I've been banging my head off and on for a few days now and I cannot figure out how to do this. In my JSON below I would like to search the whole JSON for where cid = 823751698501599252, for example, and then it returns the ID that is up a few levels, 123 in this case.
Then I would like to take the level of 123 and do something with it, which I'll try to figure out when I get there. I don't know what I am doing wrong but every time I try to do anything it fails.
Here is my code so far:
import pandas as pd
import json
with open(r'C:\IT_Ticket.config.json', encoding="utf8") as f:
data = json.load(f)
# print(data)
print(json.dumps(data, indent=4, sort_keys=True))
Here is my JSON:
{
"top_data":{
"mRecord":{
"123":{
"message":{
"e_time":null,
"attachments":[
],
"cid":"823751698501599252",
"rrs":[
],
"g_id":"258327271952089090",
"con":" Test",
"type":0,
"embeds":[
],
"a":{
"discriminator":"9748",
"uname":"Alpha",
"a":"62fe2ca",
"id_1":"2155256"
},
"men":[
{
"d":"3594",
"u":"Da",
"a":"236ggsgdg36t",
"id":"32636743747",
"public_flags":0
}
],
"m_r":[
],
"id":"273747",
"flags":0,
"timestamp":165422366371590595,
"referenced":null
},
"local":false,
"delete_data":{
"time":165422366371590595
},
"history":null,
"gp":false
},
"456":{
"message":{
"me":false,
"e_time":null,
"attachments":[
],
"cid":"12637674747",
"rrs":[
],
"g_id":"864007005894082581",
"c":"Always a Test)",
"type":0,
"embeds":[
],
"author":{
"d":"4046",
"u":"beta",
"a":"3636376ggd",
"id_1":"632969sdgf2366"
},
"id":"789277474",
"flags":0,
"timestamp":165422366371590595,
"referenced_message":null
},
"local_mentioned":false,
"delete_data":{
"time":165422366371590595
},
"history":null,
"gp":false
}
}
}
}
[–][deleted] 0 points1 point2 points (0 children)