{{ with $jsonDoc := `{
  "services": [
    {
      "name": "service1",
      "port": 8000
    }, {
        "name": "service2",
        "port": 9000
    }
  ]
}` }}

    NAME0={{ jsonQuery $jsonDoc "services.[0].name" }}
    PORT0={{ jsonQuery $jsonDoc "services.[0].port" }}
    NAME1={{ jsonQuery $jsonDoc "services.[1].name" }}
    PORT1={{ jsonQuery $jsonDoc "services.[1].port" }}

    {{ range $index, $value := jsonQuery $jsonDoc "services" }}
        Index: {{ printf "%v" $index }}
        Name: {{ printf "%v" $value.name }}
        Port: {{ printf "%v" $value.port }}
        ---
    {{end}}

{{end}}