From 505270162406fe5982732268c2a031ba361cd2c0 Mon Sep 17 00:00:00 2001 From: Jotham Read Date: Fri, 2 Oct 2015 21:41:35 +1300 Subject: Update ghetto_json Added support for // style comments in JSON if commentjson is installed. --- ghetto_json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ghetto_json') diff --git a/ghetto_json b/ghetto_json index 075accb..60d8542 100755 --- a/ghetto_json +++ b/ghetto_json @@ -4,6 +4,11 @@ import json import sys import shlex +try: + import commentjson + json_load = commentjson.load +except ImportError: + json_load = json.load def main(params_list): params = dict(x.split("=", 2) for x in params_list) @@ -11,7 +16,7 @@ def main(params_list): changed = False with open(path) as f: - obj = json.load(f) + obj = json_load(f) for (key, target) in params.items(): parts = key.split('.') ref = obj -- cgit v1.2.3