title: Marshalling json.RawMessage returns base64 encoded string
body: <p>I run the following code:</p>
  
  <pre><code>package main
  
  import (
      "encoding/json"
      "fmt"
  )
  
  func main() {
      raw := json.RawMessage(`{"foo":"bar"}`)
      j, err := json.Marshal(raw)
      if err != nil {
          panic(err)
      }
      fmt.Println(string(j))  
  }
  </code></pre>
  
  <p><strong>Playground:</strong> <a href="http://play.golang.org/p/qbkEIZRTPQ">http://play.golang.org/p/qbkEIZRTPQ</a></p>
  
  <p><strong>Output:</strong></p>
  
  <pre><code>"eyJmb28iOiJiYXIifQ=="
  </code></pre>
  
  <p><strong>Desired output:</strong></p>
  
  <pre><code>{"foo":"bar"}
  </code></pre>
  
  <p>Why does it base64 encode my <code>RawMessage</code> as if it was an ordinary <code>[]byte</code>?</p>
  
  <p>After all, RawMessage's implementation of MarshalJSON is just returning the byte slice</p>
  
  <pre><code>// MarshalJSON returns *m as the JSON encoding of m.
  func (m *RawMessage) MarshalJSON() ([]byte, error) {
      return *m, nil 
  }
  </code></pre>