title: Prevent Go's json.Marshal from coercing string to valid UTF-8 unicode?
body: <p>I'm trying to POST some JSON to a server using Go where special characters like ampersand must exist intact in the JSON string I'm sending.</p>
  
  <p><a href="http://play.golang.org/p/bPt9kl88-y" rel="noreferrer">http://play.golang.org/p/bPt9kl88-y</a> </p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "encoding/json"
  )
  
  func main() {
  
      type TransactionStatement struct {
          Query      string                 
      }
  
      statement := &amp;TransactionStatement{
          Query:       "my query with this &amp; that",
      }
      data, _ := json.Marshal(statement)
  
      fmt.Printf("&gt; %v", string(data))
  }
  </code></pre>
  
  <p>Go's <a href="http://golang.org/pkg/encoding/json/#Marshal" rel="noreferrer">json.Marshal</a> is converting certain characters like '&amp;' to unicode.  Which is great:</p>
  
  <blockquote>
    <p>String values encode as JSON strings coerced to valid UTF-8, replacing invalid bytes with the Unicode replacement rune. The angle brackets "&lt;" and ">" are escaped to "\u003c" and "\u003e" to keep some browsers from misinterpreting JSON output as HTML. Ampersand "&amp;" is also escaped to "\u0026" for the same reason. 
    Blockquote</p>
  </blockquote>
  
  <p>It may sound rediculous but the JSON I'm sending is for a database query using a RESTful endpoint, where this literal string will be used to perform a freetext database query - so I can't use unicode since it's interpreted literally. </p>
  
  <p>So is there any way to prevent this conversion to unicode? Or will I just have to undo these replacements <em>after</em> the marshaling is done?</p>
  
  <p>Thanks</p>