code: def submit_studio_edits(self, data, suffix=''):
          
          values = {}  # dict of new field values we are updating
          to_reset = []  # list of field names to delete from this XBlock
          for field_name in self.editable_fields:
              field = self.fields[field_name]
              if field_name in data['values']:
                  if isinstance(field, JSONField):
                      values[field_name] = field.from_json(data['values'][field_name])
                  else:
                      raise JsonHandlerError(400, "Unsupported field type: {}".format(field_name))
              elif field_name in data['defaults'] and field.is_set_on(self):
                  to_reset.append(field_name)
          self.clean_studio_edits(values)
          validation = Validation(self.scope_ids.usage_id)
          # We cannot set the fields on self yet, because even if validation fails, studio is going to save any changes we
          # make. So we create a "fake" object that has all the field values we are about to set.
          preview_data = FutureFields(
              new_fields_dict=values,
              newly_removed_fields=to_reset,
              fallback_obj=self
          )
          self.validate_field_data(validation, preview_data)
          if validation:
              for field_name, value in six.iteritems(values):
                  setattr(self, field_name, value)
              for field_name in to_reset:
                  self.fields[field_name].delete_from(self)
              return {'result': 'success'}
          else:
              raise JsonHandlerError(400, validation.to_json())
docs: AJAX handler for studio_view() Save button