Skip to content

Commit

Permalink
Fix incorrect order in JSON output
Browse files Browse the repository at this point in the history
  • Loading branch information
thenewvu committed Feb 7, 2015
1 parent bb02512 commit 9c9de11
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion glue/formats/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def needs_rebuild(self):
return False

def render(self, *args, **kwargs):
return json.dumps(self.get_context(*args, **kwargs))
return json.dumps(self.get_context(*args, **kwargs), indent=4)


class BasePlistFormat(BaseTextFormat):
Expand Down
5 changes: 3 additions & 2 deletions glue/formats/jsonformat.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from collections import OrderedDict
import os
import json
import codecs
Expand Down Expand Up @@ -33,7 +34,7 @@ def populate_argument_parser(cls, parser):
def get_context(self, *args, **kwargs):
context = super(JSONFormat, self).get_context(*args, **kwargs)

frames = dict([[i['filename'], {'filename': i['filename'],
frames = OrderedDict([[i['filename'], {'filename': i['filename'],
'frame': {'x': i['x'],
'y': i['y'],
'w': i['width'],
Expand All @@ -47,7 +48,7 @@ def get_context(self, *args, **kwargs):
'sourceSize': {'w': i['original_width'],
'h': i['original_height']}}] for i in context['images']])

data = dict(frames=None, meta={'version': context['version'],
data = OrderedDict(frames=None, meta={'version': context['version'],
'hash': context['hash'],
'name': context['name'],
'sprite_path': context['sprite_path'],
Expand Down

0 comments on commit 9c9de11

Please sign in to comment.