def form_invalid(self, form):
response = {self.errors_key: {}}<EOL>response[self.non_field_errors_key] = form.non_field_errors()<EOL>response.update(self.get_hidden_fields_errors(form))<EOL>for field in form.visible_fields():<EOL><INDENT>if field.errors:<EOL><INDENT>response[self.errors_key][field.html_name] = self._get_field_error_dict(field)<EOL><DEDENT><DEDENT>if self.include_success:<EOL><INDENT>response[self.sucess_key] = False<EOL><DEDENT>return self._render_json(response)<EOL>
Builds the JSON for the errors