ChatON:P2:meta json to hpp conversion - add k-v pairs skeleton

This commit is contained in:
HanishKVC 2024-05-12 12:40:33 +05:30
parent 0c21a0084f
commit 078e04d32b

View file

@ -5,9 +5,17 @@
import sys import sys
import json import json
def kv(j, tmpl, k1, k2, comma):
print("\t\t{{ \"{}\", \"{}\" }}{}".format("{}-{}".format(k1,k2), j[tmpl][k1][k2], comma))
fp=open(sys.argv[1]) fp=open(sys.argv[1])
j=json.load(fp) j=json.load(fp)
print("{") print("{")
for tmpl in j: for tmpl in j:
print("\t{{ \"{}\", ".format(tmpl)) print("\t{{ \"{}\", {{".format(tmpl))
kv(j, tmpl, "global", "begin", ",")
kv(j, tmpl, "global", "end", ",")
print("\t}},")