diff options
author | Lars Wirzenius <liw@liw.fi> | 2011-08-08 15:23:55 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2011-08-08 15:23:55 +0100 |
commit | 2d85bea835f5d7466a7bb150bfd562c72d81791c (patch) | |
tree | 58ec6a5a3a3265c853bc86b6a2b59abec90fc1f2 /summain | |
parent | c1e5658403b5fa4d0c6f0dfe2326027fbff5bf1e (diff) | |
download | summain-2d85bea835f5d7466a7bb150bfd562c72d81791c.tar.gz |
Fix JSON output so it's all one JSON list.
Diffstat (limited to 'summain')
-rwxr-xr-x | summain | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -72,7 +72,12 @@ class CSV(OutputFormat): class Json(OutputFormat): - def write_object(self, name, o): + def write(self): + json.dump(list(self.dictify(name, o) for name, o in self.objects), + self.output, sort_keys=True, indent=1) + self.output.write('\n') + + def dictify(self, name, o): keys = self.keys + self.checksums values = { 'Name': name } @@ -80,8 +85,7 @@ class Json(OutputFormat): if o[k] != '': values[k] = o[k] - json.dump(values, self.output, sort_keys=True, indent=1) - self.output.write('\n') + return values class Summain(cliapp.Application): |