title: Why is Go json.Marshal rejecting these struct tags? What is proper syntax for json tags?
body: <p>I am trying to use json.Marshal but it refuses to accept my struct tags.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Here is the source code for "marshal.go"</p>
  
  <p><a href="https://play.golang.org/p/eFe03_89Ly9" rel="noreferrer">https://play.golang.org/p/eFe03_89Ly9</a></p>
  
  <pre><code>package main
  
  import (
      "encoding/json"
      "fmt"
  )
  
  type Person struct {
      Name string `json: "name"`
      Age  int    `json: "age"`
  }
  
  func main() {
      p := Person{Name: "Alice", Age: 29}
      bytes, _ := json.Marshal(p)
      fmt.Println("JSON = ", string(bytes))
  }
  </code></pre>
  
  <p>I get these error messages from "go vet marshal.go"</p>
  
  <pre><code>./marshal.go:9: struct field tag `json: "name"` not compatible with reflect.StructTag.Get: bad syntax for struct tag value
  ./marshal.go:10: struct field tag `json: "age"` not compatible with reflect.StructTag.Get: bad syntax for struct tag value
  </code></pre>
  
  <p>I get this output when I run the program.</p>
  
  <pre><code>% ./marshal
  JSON =  {"Name":"Alice","Age":29}
  </code></pre>
  
  <p>Notice the field names match the Go structure and ignore the json tags.</p>
  
  <p>What am I missing?</p>