title: How to convert JSON to list string, when some of the JSON objects are string and some are array?
body: <p>My JSON looks like</p>
  
  <pre><code>{
  "d": {
  "__type": "CubeJsonData",
  "SessionID": null,
  "Code": 0,
  "Message": "",
  "Rows": {},
  "Columns": {
    "Place 1": [
      0,
      1
    ],
    "Place 2": [
      0,
      2,
      4,
      6
    ],
  },
  "Set": [
    [
      "Number 1"
    ],
    [
      "Number 2"
    ],
    [
      "Number 3"
    ]
  ]
  }
  }
  </code></pre>
  
  <p>I need to get the following values</p>
  
  <pre><code>List&lt;string&gt; Columns must contain: "Place 1", "Place 2"
  List&lt;string&gt; Set must contain: "Number 1", "Number 2", "Number 3"
  </code></pre>
  
  <p>My caller is</p>
  
  <pre><code>var settings = new JsonSerializerSettings();
  settings.Converters.Add(new AssosiativeArrayConverter());
  var staffAlerts = JsonConvert.DeserializeObject&lt;List&lt;AlertDetails&gt;&gt;(jo.ToString(), settings);
  </code></pre>
  
  <p>My JsonConverter is </p>
  
  <pre><code>class AssosiativeArrayConverter : JsonConverter
  {
      public override bool CanConvert(Type objectType)
      {
          return (objectType == typeof(string)) || (objectType == typeof(List&lt;string&gt;));
      }
  
      public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
      {
          if (reader.TokenType == JsonToken.StartArray)
          {
              var l = new List&lt;string&gt;();
              reader.Read();
              while (reader.TokenType != JsonToken.EndArray)
              {
                  l.Add(reader.Value as string);
  
                  reader.Read();
              }
              return l;
          }
          else
          {
              return new List&lt;string&gt; { reader.Value as string };
          }
      }
  
      public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
      {//to do
      }
  }
  </code></pre>
  
  <p>My class is</p>
  
  <pre><code>class StaffDetail
  {
      public string __type { get; set; }
      public string SessionID { get; set; }
      public string Code { get; set; }
      public string Message { get; set; }
  
      [JsonConverter(typeof(AssosiativeArrayConverter))]
      public List&lt;string&gt; Rows { get; set; }
      [JsonConverter(typeof(AssosiativeArrayConverter))]
      public List&lt;string&gt; Columns { get; set; }
      [JsonConverter(typeof(AssosiativeArrayConverter))]
      public List&lt;string&gt; Set { get; set; }
  }
  </code></pre>
  
  <p>I am getting an error  </p>
  
  <blockquote>
    <p>Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[ReportingServicesAlerts.AlertDetails]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
    To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.</p>
  </blockquote>
  
  <p>Can you help me figure out what I'm doing wrong?  </p>