title: Using JsonWriter with dynamic class list
body: <p>I currently have a list builder from a separate class:</p>
  
  <pre><code>public class psuedoMe {
      public string relName { get; set; }
      public List&lt;string&gt; lstName { get; set; }
  }
  </code></pre>
  
  <p>I have a function that populates this, but then writes it to <code>Json</code> using <code>Newtonsoft.Json.JsonWriter</code>:</p>
  
  <pre><code>private static string returnJson(List&lt;psuedoMe&gt; sentList)
  {
      StringBuilder jsonSB = new StringBuilder();
      StringWriter jsonSW = new StringWriter(jsonSB);
      using (JsonWriter jsonWrite = new JsonTextWriter(jsonSW))
      {
          jsonWrite.WriteStartArray();
          foreach (psuedoMe sentItem in sentList)
          {
              jsonWrite.WriteStartObject();
              foreach (System.Reflection.PropertyInfo propInfo in sentItem.GetType().GetProperties())
              {
                  jsonWrite.WritePropertyName(propInfo.Name);
                  jsonWrite.WriteValue(propInfo.GetValue(sentItem, null));
              }
              jsonWrite.WriteEndObject();
          }
          jsonWrite.WriteEndArray();
      }
      return jsonSB.ToString();
  }
  </code></pre>
  
  <p>However I am receiving an error when it tries to write the <code>public List&lt;string&gt; lstName</code> into <code>jsonSB</code>. I've tried excluding only the <code>lstName</code> from the <code>JsonWriter</code> however this only then loops through the list and doesn't write it to the <code>jsonSB</code> at the end.</p>
  
  <p>Is there anyway of using the above <code>returnJson</code> to write to the list of <code>strings</code>?</p>
  
  <p>There error I get is: <code>Newtonsoft.Json.JsonWriterException: Unsupported type: System.Collections.Generic.List1[System.String].</code></p>