# yo
import json
import urllib
path = "../client/data/categories.json"
json_file=open(path)
data = json.load(json_file)
json_file.close()
output = []
for c in data["categories"]:
if "subcategories" in c and len(c["subcategories"])>0:
for sc in c["subcategories"]:
output.append({"name": sc["code"],"keywords": [ sc["label"] ], "color" : sc["color"] })
else:
output.append({"name": c["code"],"keywords": [ c["label"] ], "color" : c["color"] })
print "SIMPLE JSON DUMPS :"
print json.dumps(output)
print "\nURLLIB QUOTE_PLUS JSON DUMPS :"
print urllib.quote_plus(json.dumps(output))