From 37fa32ce941ba558870eb35abe042ae73b692579 Mon Sep 17 00:00:00 2001 From: Martin Stjernholm Date: Mon, 24 Feb 2020 15:52:31 +0000 Subject: Output json without trailing whitespaces but with trailing newlines. Makes them more editor friendly, primarily when copied into system/linkerconfig/testdata/root. Test: m Test: No diff between apex_manifest_full.json in out/ and in linkerconfig/testdata/root/ Bug: 140599044 Change-Id: I6dacdd4baa59e6d70586c4a6343b9b8fd1b574f6 --- scripts/jsonmodify.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts/jsonmodify.py') diff --git a/scripts/jsonmodify.py b/scripts/jsonmodify.py index 4b2c3c250..ba1109e7a 100755 --- a/scripts/jsonmodify.py +++ b/scripts/jsonmodify.py @@ -112,9 +112,10 @@ def main(): if args.out: with open(args.out, "w") as f: - json.dump(obj, f, indent=2) + json.dump(obj, f, indent=2, separators=(',', ': ')) + f.write('\n') else: - print(json.dumps(obj, indent=2)) + print(json.dumps(obj, indent=2, separators=(',', ': '))) if __name__ == '__main__': -- cgit v1.2.3-59-g8ed1b