title: interface{} to []byte conversion in golang
body: <p>I am trying to unmarshal data which is of type interface. So I need to convert the interface type to <code>[]byte</code> and pass it to unmarshal.
  I tried</p>
  <ol>
  <li><code>err := json.Unmarshal([]byte(kpi), &amp;a)</code> =&gt; failed</li>
  <li>to convert the interface to <code>[]byte</code> using<br />
  <code>kpidata, res := kpi.([]byte)</code> =&gt; failed, <code>kpidata</code> is <code>nil</code></li>
  </ol>
  <p>So is there any way we can convert it?</p>
  <p>Example: <a href="https://play.golang.org/p/5pqQ0DQ94Dp" rel="nofollow noreferrer">https://play.golang.org/p/5pqQ0DQ94Dp</a></p>