title: How to print JSON on golang template?
body: <p>I need a object in client side, so I converted it to JSON using json.marshal and printed it into template. The object is getting printed as escaped JSON string.</p>
  
  <p>I'm expecting it to be <code>var arr=["o1","o2"]</code> but it is <code>var arr="[\"o1\",\"o2\"]"</code></p>
  
  <p>I know I can JSON.parse in client side, but is that the only way?</p>
  
  <p>Here is how I'm printing it in template:</p>
  
  <p><code>{{ marshal .Arr }}</code></p>
  
  <p>Here is my marshal function:</p>
  
  <pre><code>"marshal": func(v interface {}) string {
    a, _ := json.Marshal(v)
    return string(a)
  },
  </code></pre>