Added json helper to send errors as JSON data.