c# - JSON with square brackets not possible to deserialize with RestSharp
<p>hopefully you can help me. I want to print the "label" of one of the elements.</p>

<p>JSON input:</p>

<pre><code>[
  {
    "entity":{
      "type":"postcode",
      "id":"P11516",
      "label":"18314 Divitz-Spoldershagen",
      "value":"18314"
    },
    "matches":[
      {
        "offset":0,
        "length":5
      }
    ]

  },
  {
    "entity":{
      "type":"postcode",
      "id":"P11541",
      "label":"18314 Kenz-Küstrow",
      "value":"18314"
    },
    "matches":[
      {
        "offset":0,
        "length":5
      }
    ]

  },
  {
    "entity":{
      "type":"postcode",
      "id":"P11549",
      "label":"18314 Löbnitz",
      "value":"18314"
    },
    "matches":[
      {
        "offset":0,
        "length":5
      }
    ]

  },
  {
    "entity":{
      "type":"postcode",
      "id":"P11551",
      "label":"18314 Lüdershagen",
      "value":"18314"
    },
    "matches":[
      {
        "offset":0,
        "length":5
      }
    ]
  }
]
</code></pre>

<p>And the API call with JsonDeserializer</p>

<pre><code>public string callGACWithPLZSandbox(string plz)
{
    var client = new RestClient("http://rest.sandbox-immobilienscout24.de");
    var request = new RestRequest("restapi/api/gis/v2.0/geoautocomplete/DEU", Method.GET);
    client.ClearHandlers();
    client.AddHandler("application/json", new JsonDeserializer());
    request.AddQueryParameter("i", plz);
    request.AddQueryParameter("t", "postcode");
    request.AddHeader("bla", "blub");
    IRestResponse&lt;Rootobject&gt; response = client.Execute&lt;Rootobject&gt;(request);

    return response.Data.Property1[1].entity.label;
}
</code></pre>

<p>And, the classes</p>

<pre><code>class Rootobject
{
    public Class1[] Property1 { get; set; }
}

class Class1
{
    public Entity entity { get; set; }
    public Match[] matches { get; set; }
}

class Entity
{
    public string type { get; set; }
    public string id { get; set; }
    public string label { get; set; }
    public string value { get; set; }
}

 class Match
{
    public int offset { get; set; }
    public int length { get; set; }
}
</code></pre>

<p>What am I doing wrong? Result is always "NullReferenceException: Object reference not set to an instance of an object"...</p>