title: Convert Struct to JSON in Golang
body: <p>New to Golang here and I'm trying to get a struct to convert to a JSON object that one of my other applications will consume. </p>
  
  <p>The expected response will look something like this...</p>
  
  <pre class="lang-golang prettyprint-override"><code>"access": {
        "STOCK": "1",
        "FOREX": "1",
        "WEBFOREX": "1",
        "WEBSTOCK": "1"
      },
  "subscription_group_dates": {
        "32": {
              "START_DATE": 1464753600,
              "END_DATE": 1472616000
              },
        "42": {
              "START_DATE": 1470024000,
              "END_DATE": 1472616000
            }
      }
  </code></pre>
  
  <p>I have left in the "access" part of the object to show the parts I know work. Everything else has been omitted for brevity.  The tough part for me is handling the nesting nature of structs in golang... The following Struct I think will work, but I'm not sure about the syntax. </p>
  
  <p>Under the SubscriptionGroupDates Type... can I use map[string]struct and embed the rest as shown?. see below</p>
  
  <pre class="lang-golang prettyprint-override"><code>type UCSUserAccess struct {
      Groups          map[string]string           `json:"groups"`
      Access          map[string]string           `json:"access"`
      IsExpert        string                      `json:"isExpert"`
      SubscriptionGroupDates map[string]struct {
          GroupID struct {
              StartDate map[string]int `START_DATE`
              EndDate   map[string]int `END_DATE`
              }
      } `json:"subscription_group_dates"`
  }
  </code></pre>
  
  <p>In addition... I have imported the "time" library in the import section. How would I use that to declare the dates as time objects? (instead of map[string]int)</p>
  
  <p>Thanks</p>