Return JSON object in error responses