title: golang: quickly access data of maps within maps
body: <p>So I've got the following bit of JSON and I want to pull out the "$t" value under "token".  Continue for Go code...</p>
  
  <pre><code>{
    "@encoding": "iso-8859-1",
    "@version": "1.0",
    "service": {
      "auth": {
        "expiresString": {
          "$t": "2013-06-12T01:15:28Z"
        },
        "token": {
          "$t": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
        },
        "expires": {
          "$t": "1370999728"
        },
        "key": {
          "$t": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
        }
      }
  }
  </code></pre>
  
  <p>I have the following snippet of Go code that unmarshals the json into an interface. Then I work my way down to the "$t" value of "token".  This approach does work, but it's ugly.</p>
  
  <p><strong>My question: is there a faster way to access that value than by converting each map into an interface?</strong>  I'm very new to Go and am not aware of many of the useful features of interfaces and maps.</p>
  
  <pre><code>var f interface{}
  jerr := json.Unmarshal(body, &amp;f)
  m := f.(map[string]interface{})
  ser := m["service"].(map[string]interface{})
  a := ser["auth"].(map[string]interface{})
  tok := a["token"].(map[string]interface{})
  token := tok["$t"]
  fmt.Fprintf(w, "Token: %v\n", token)
  </code></pre>
  
  <p>Thanks in advance!</p>