title: How to sanitize input data in golang?
body: <p>I am trying to sanitize input shortly before marshaling the submitted data into a specified struct.</p>
  
  <p>Here is the model that I am using.</p>
  
  <pre><code>type Post struct {
      Id               int       `json:"Id"`
      CreatedAt        time.Time `json:"CreatedAt"`
      UpdatedAt        time.Time `json:"UpdatedAt"`
      CreatorId        int       `json:"CreatorId"`
      Creator          *User
      Editors          []int  `json:"Editors"`
      Status           Status `json:"Status"`
      Title            string `json:"Title"`
      ShortDescription string `json:"ShortDescription"`
      Description      string `json:"Description"`
      Content          string `json:"Content"`
      Url              string `json:"Url"`
      Media            *Media
      Categories       []Category `json:"Categories"`
      Tags             []Tag      `json:"Tags"`
      MediaId          int        `json:"MediaId"`
      Keywords         string     `json:"Keywords"`
      Data             []string   `json:"Data"`
  }
  </code></pre>
  
  <p>Here is an example of a possible submitted JSON data</p>
  
  <pre><code>{"Id":1,"CreatedAt":"2016-10-11T21:29:46.134+02:00","UpdatedAt":"0001-01-01T00:00:00Z","CreatorId":1,"Editors":null,"Status":1,"Title":"This is the title of the first post, to be changed.&lt;script&gt;alert()&lt;/script&gt;","ShortDescription":"this is the short description of this post","Description":"","Content":"Contrary to popular belief Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC making it over 2000 years old. Richard McClintock","Url":"lorem-ipsum-first"}
  </code></pre>
  
  <p>How would I most effectively sanitize the above JSON form data during the <code>ReadJSON</code> request and before data insertion during this process, thus removing any malicious code as seen with <code>&lt;script&gt;alert()&lt;/script&gt;.</code>?
  If there is any additional information that could be of use please ask and I will be glad to add it.
  Thanks</p>