output formatted as JSON, handle ValueErrors