blob: 8a7c6fa47ac59183388ea21f55ea8e272c9d2340 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import json, os
parents = {}
for itemJsonFileName in os.listdir("./items"):
with open("./items/"+itemJsonFileName, "rb") as f:
try:
itemJson = json.load(f);
except:
print("BROKEN JSON:"+itemJsonFileName)
if "parent" in itemJson:
parent = itemJson["parent"]
if not parent in parents:
parents[parent] = []
parents[parent].append(itemJson["internalname"])
print(parents)
with open("./parents.json", "w") as f:
json.dump(parents, f, indent=4, sort_keys=True)
|