diff -r 5d392dea4f49 -r 2d0e6a207048 utils/create_url_polemics_param.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utils/create_url_polemics_param.py Fri Oct 17 16:51:48 2014 +0200 @@ -0,0 +1,22 @@ +# 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)) \ No newline at end of file