code: function validateInputAsJson() {
    if (this.value) {
      try {
        JSON.parse(this.value);
        setValidationClasses(this, true);
      }
      catch(e) {
        setValidationClasses(this, false);
      }
    }
    else {
      setValidationClasses(this, false)
    }
  }
docs: method to check if a input field contains valid json and set visual accordingly.