title: How to iterate over an []interface{} in Go
body: <p>I'm struggling to get the <strong>keys and values</strong> of the following interface, which is the result of JSON marshaling the result returned by <a href="https://godoc.org/github.com/qasaur/gremgo#Client.Execute" rel="noreferrer"><code>Execute</code></a> as demonstrated in <a href="https://github.com/qasaur/gremgo#example" rel="noreferrer">this example</a>:</p>
  
  <pre><code>[
      [
          {
              "id": 36,
              "label": "TestThing",
              "properties": {
                  "schema__testBoolean": [
                      {
                          "id": 40,
                          "value": true
                      }
                  ],
                  "schema__testInt": [
                      {
                          "id": 39,
                          "value": 1
                      }
                  ],
                  "schema__testNumber": [
                      {
                          "id": 38,
                          "value": 1.0879834
                      }
                  ],
                  "schema__testString": [
                      {
                          "id": 37,
                          "value": "foobar"
                      }
                  ],
                  "uuid": [
                      {
                          "id": 41,
                          "value": "7f14bf92-341f-408b-be00-5a0a430852ee"
                      }
                  ]
              },
              "type": "vertex"
          }
      ]
  ]
  </code></pre>
  
  <p>A <code>reflect.TypeOf(result)</code> results in: <code>[]interface{}</code>.</p>
  
  <p>I've used this to loop over the array:</p>
  
  <pre><code>s := reflect.ValueOf(result)
  for i := 0; i &lt; s.Len(); i++ {
    singleVertex := s.Index(i).Elem() // What to do here?
  }
  </code></pre>
  
  <p>But I'm getting stuck with errors like: </p>
  
  <blockquote>
    <p>reflect.Value.Interface: cannot return value obtained from unexported
    field or method</p>
  </blockquote>