Format json files deterministically and make diffs useful
This commit is contained in:
parent
0b95901703
commit
97fdbbcdf5
1 changed files with 1 additions and 1 deletions
|
|
@ -76,7 +76,7 @@ class JsonFile(File):
|
||||||
self.set(path, TAG)
|
self.set(path, TAG)
|
||||||
|
|
||||||
def to_text(self) -> TextFile:
|
def to_text(self) -> TextFile:
|
||||||
return TextFile(json.dumps(self.data))
|
return TextFile(json.dumps(self.data, sort_keys=True, indent=2) + "\n")
|
||||||
|
|
||||||
def to_bytes(self) -> bytes:
|
def to_bytes(self) -> bytes:
|
||||||
return self.to_text().to_bytes()
|
return self.to_text().to_bytes()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue