Emit errors in JSON output properly

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>