Strip HTML tags from validation errors I am using Services 3.x for creating web services for mobile application, and I am using the JSON format.

The validation errors given from the user register services comes with HTML tags; for example the email already exists error is the following one.

&lt;em&gt; the@email.com&lt;/em&gt; is already in use.  Have you forgotten your password?".


How do I strip those HTML tags from the error message?
hook_services_request_postprocess_alter() looks like a good candidate. I don't have an installation to test with right now but something like this ought to work:

function MYMODULE_services_request_postprocess_alter($controller, $args, &amp;$result) {
  if (isset($result['form_errors'])) {
    array_walk($result['form_errors'], function(&amp;$error) {
      $error = strip_tags($error);
    });
  }
}