def output_json(self, text):
payload = json.loads(text)<EOL>data = []<EOL>metric_name = self._metric_name<EOL>for r in payload['<STR_LIT:result>']['<STR_LIT>']['<STR_LIT:key>']:<EOL><INDENT>timestamp = self._format_timestamp(r[<NUM_LIT:0>][<NUM_LIT:0>])<EOL>for s in r[<NUM_LIT:1>]:<EOL><INDENT>data.append({<EOL>"<STR_LIT>": timestamp,<EOL>"<STR_LIT>": metric_name,<EOL>"<STR_LIT>": self.aggregate,<EOL>"<STR_LIT:source>": s[<NUM_LIT:0>],<EOL>"<STR_LIT:value>": s[<NUM_LIT:1>],<EOL>})<EOL><DEDENT><DEDENT>payload = {"<STR_LIT:data>": data}<EOL>out = json.dumps(payload, indent=self._indent, separators=('<STR_LIT:U+002C>', '<STR_LIT>'))<EOL>print(self.colorize_json(out))<EOL>
Output results in structured JSON format