title: How should I correctly parse this data in to a struct to avoid the "expression expected" error/warning and successfully build the JSON?
body: <p>I'm writing a test program in Go, which takes 5 inputs and will marshal it to JSON and then return it back to the caller.</p>
  <p>The JSON structure is defined externally to me so I'm unable to simplify it - even though I reckon it needs it - so I just have to deal with the annoying structure of the payload.</p>
  <p>Trouble is, I cannot get it to parse/initialise correctly at all. It keeps complaining about &quot;expected expression&quot; and I can't work out why.</p>
  <p>It's worth noting that I had to use one of those JSON-to-struct generators as I couldn't work out what the struct should actually look like, then I tried to clean it up a bit. There could be an error here I'm not seeing.</p>
  <h3>json</h3>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;outer&quot;: [
          {
              &quot;inner&quot;: {
                  &quot;key1&quot;: &quot;...&quot;,
                  &quot;key2&quot;: &quot;...&quot;,
                  &quot;key3&quot;: &quot;...&quot;,
                  &quot;key4&quot;: &quot;...&quot;,
                  &quot;key5&quot;: &quot;...&quot;
              }
          }
      ]
  }
  </code></pre>
  <h3>structs</h3>
  <pre class="lang-golang prettyprint-override"><code>type Payload struct {
      Outer []struct {
          Inner InnerTestData `json:&quot;inner&quot;`
      } `json:&quot;outer&quot;`
  }
  
  type InnerTestData struct {
      Alertname   string `json:&quot;key1&quot;`
      QueueInHrs  string `json:&quot;key2&quot;`
      QueueOutHrs string `json:&quot;key3&quot;`
      Urgency     string `json:&quot;key4&quot;`
      Impact      string `json:&quot;key5&quot;`
  }
  </code></pre>
  <h3>code</h3>
  <pre class="lang-golang prettyprint-override"><code>func main() {
      if len(os.Args) != 5 {
          fmt.Println(&quot;ERROR: There should be 5 args&quot;)
          os.Exit(1)
      }
  
      key1 := os.Args[1]
      key2 := os.Args[2]
      key3 := os.Args[3]
      key4 := os.Args[4]
      key5 := os.Args[5]
  
      innerTestData := InnerTestData{
          Key1: key1,
          Key2: key2,
          Key3: key3,
          Key4: key4,
          Key5: key5,
      }
  
      payload := Payload{
          Outer: []struct{
              Inner: innerTestData,
          },
      }
  }
  </code></pre>
  <p>I'm just confused as to how I should actually be parsing this in to the Payload struct, I've tried every combination I can think of without any luck. I'm aware this is probably something simple going wrong, but the whole having to create a struct that perfectly matches the JSON payload situation is really over-complicated and confusing, I find.</p>
  <p>Any help appreciated. Cheers.</p>