title: MarshalJSON error , invalid character "g" after top-level
body: <p>I made a custom type for my IDs:</p>
  
  <pre><code>type ID uint
  
  func (id ID) MarshalJSON() ([]byte, error) {
      e, _ := HashIDs.Encode([]int{int(id)})
      fmt.Println(e) /// 34gj
      return []byte(e), nil
  }
  
  func (id *ID) Scan(value interface{}) error {
      *id = ID(value.(int64))
      return nil
  }
  </code></pre>
  
  <p>I use the HashIDs package to encode my ids so that user wont be able to read them on client side. But I'm getting this error:</p>
  
  <blockquote>
    <p>json: error calling MarshalJSON for type types.ID: invalid character 'g' after top-level value</p>
  </blockquote>