Fix invalid JSON when both results and errors present in response