pretty-print JSON output

This commit is contained in:
Colin McMillen 2019-10-02 15:30:36 -04:00
parent 46e5a34120
commit eeb0f0a4db

View File

@ -4,10 +4,8 @@ import glob
import json import json
import os import os
import pygame import pygame
import random
import re import re
import sys import sys
from PIL import Image
# The guide in tiles/guide.png is quite helpful. # The guide in tiles/guide.png is quite helpful.
@ -248,7 +246,7 @@ def annotate_sprites(sprite_files, all_metadata):
filename, all_metadata.get(filename)) filename, all_metadata.get(filename))
all_metadata[filename] = sprite_metadata all_metadata[filename] = sprite_metadata
with open('metadata.json', 'w') as f: with open('metadata.json', 'w') as f:
json.dump(all_metadata, f) json.dump(all_metadata, f, sort_keys=True, indent=2)
if quit: if quit:
return return