format output json to comply with chunked protocol