title: Marshal int slice to string line
body: <p>I have a struct as this:</p>
  <pre><code>type Int64Slice []int64
  type DataWrapper struct {
      ListId Int64Slice    `json:&quot;listid&quot; required`
      Domain string `json:&quot;domain&quot; required`
      Name   string `json:&quot;name,omitempty&quot;`
  }
  </code></pre>
  <p>And I need it become:</p>
  <pre><code>{
      &quot;listid&quot;: &quot;1 2 3 4 5&quot;,
      &quot;domain&quot;: &quot;mydomain&quot;
  }
  </code></pre>
  <p>I have wrote custom MarshalJSON:</p>
  <pre><code>func (u Int64Slice) MarshalJSON() ([]byte, error) {
      var result string
      if u == nil {
          result = &quot;null&quot;
      } else {
          result = strings.Trim(strings.Join(strings.Fields(fmt.Sprint(u)), &quot; &quot;), &quot;[]&quot;)
          Logger.Debugln(result)
      }
      return []byte(result), nil
  }
  
  func (d *DataWrapper) ToJSON() []byte {
      result, err := json.Marshal(d)
      if err != nil {
          log.Fatalln(err)
          panic(err)
      }
      return result
  }
  </code></pre>
  <p>At the line <code>Logger.Debugln(result)</code>, it prints this result:</p>
  <blockquote>
  <p>20170830090317506 20170830090026319 20170830111023194 201708301043081 ...</p>
  <p>json: error calling MarshalJSON for type models.Int64Slice: invalid
  character '2' after top-level value</p>
  </blockquote>