summaryrefslogtreecommitdiff
path: root/scripts/jsonmodify.py
diff options
context:
space:
mode:
authorMartin Stjernholm <mast@google.com>2020-02-24 15:52:31 +0000
committerMartin Stjernholm <mast@google.com>2020-02-24 22:20:49 +0000
commit37fa32ce941ba558870eb35abe042ae73b692579 (patch)
treee664a622ad1ac2fef49a0d7a67e4c95420152edd /scripts/jsonmodify.py
parentefbce1caced34559a9656916bfcdc944ba55048d (diff)
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
Diffstat (limited to 'scripts/jsonmodify.py')
-rwxr-xr-xscripts/jsonmodify.py5
1 files changed, 3 insertions, 2 deletions
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__':