title: JSON with multiple arrays to C# arraylist or list or custom object and display as details
body: <p>I have the below JSON content in a file.</p>
  <pre><code>[{
          &quot;projectCode&quot;: &quot;ICSM000003SM_Prj1&quot;,
          &quot;name&quot;: &quot;Story mapping&quot;,
          &quot;id&quot;: &quot;5eeb94710ce4e01aac9ac3e2&quot;,
          &quot;workRequests&quot;: [{
                  &quot;name&quot;: &quot;test issue&quot;,
                  &quot;project&quot;: &quot;5eeb94710ce4e01aac9ac3e2&quot;,
                  &quot;id&quot;: &quot;5eeb94930ce4e01aac9ac3ef&quot;,
                  &quot;url&quot;: &quot;http://example.com/form?collectorid=5eeb94930ce4e01aac9ac3ef&amp;icentid=5e8eff6b99ba793a08461372&amp;projectid=5eeb94710ce4e01aac9ac3e2&amp;source=mail&quot;
              },
              {
                  &quot;name&quot;: &quot;defect issue collector&quot;,
                  &quot;project&quot;: &quot;5eeb94710ce4e01aac9ac3e2&quot;,
                  &quot;id&quot;: &quot;5eee564170e0d814d0dd5288&quot;,
                  &quot;url&quot;: &quot;http://example.com/form?collectorid=5eee564170e0d814d0dd5288&amp;icentid=5e8eff6b99ba793a08461372&amp;projectid=5eeb94710ce4e01aac9ac3e2&amp;source=mail&quot;
              }
          ]
      },
      {
          &quot;projectCode&quot;: &quot;ICSM000001IC100&quot;,
          &quot;name&quot;: &quot;issue collector&quot;,
          &quot;id&quot;: &quot;5e8eff7c99ba793a08461375&quot;,
          &quot;workRequests&quot;: [{
                  &quot;name&quot;: &quot;SE issue collector&quot;,
                  &quot;project&quot;: &quot;5e8eff7c99ba793a08461375&quot;,
                  &quot;id&quot;: &quot;5e96864599ba7923a488194a&quot;,
                  &quot;url&quot;: &quot;http://example.com/form?collectorid=5e96864599ba7923a488194a&amp;icentid=5e8eff6b99ba793a08461372&amp;projectid=5e8eff7c99ba793a08461375&amp;source=mail&quot;
              },
              {
                  &quot;name&quot;: &quot;test&quot;,
                  &quot;project&quot;: &quot;5e8eff7c99ba793a08461375&quot;,
                  &quot;id&quot;: &quot;5ee36aef1ad1de3c10fa9aa6&quot;,
                  &quot;url&quot;: &quot;http://example.com/form?collectorid=5ee36aef1ad1de3c10fa9aa6&amp;icentid=5e8eff6b99ba793a08461372&amp;projectid=5e8eff7c99ba793a08461375&amp;source=mail&quot;
              }
          ]
      },
      {
          &quot;projectCode&quot;: &quot;ICSM000005SM_SP&quot;,
          &quot;name&quot;: &quot;Single project sm&quot;,
          &quot;id&quot;: &quot;5eee566970e0d814d0dd5289&quot;,
          &quot;workRequests&quot;: [{
              &quot;name&quot;: &quot;feedback collector&quot;,
              &quot;project&quot;: &quot;5eee566970e0d814d0dd5289&quot;,
              &quot;id&quot;: &quot;5eee568c70e0d814d0dd5296&quot;,
              &quot;url&quot;: &quot;http://example.com/form?collectorid=5eee568c70e0d814d0dd5296&amp;icentid=5e8eff6b99ba793a08461372&amp;projectid=5eee566970e0d814d0dd5289&amp;source=mail&quot;
          }]
      }
  ]
  </code></pre>
  <p>Note: The above JSON content is dynamic. Its format is the same, but all values might change when I consume a REST API from the application.</p>
  <p>Below is my code for converting JSON to treeview, but I want to display it in List or Details format.</p>
  <pre><code>public static void AddObjectNodes(JObject @object, string name, TreeNodeCollection parent)
      {
          var node = new TreeNode(name);
      //    if ()
          parent.Add(node);
  
          foreach (var property in @object.Properties())
          {
              AddTokenNodes(property.Value, property.Name, node.Nodes);
          }
      }
      private static void AddTokenNodes(JToken token, string name, TreeNodeCollection parent)
      {
          if (token is JValue)
          {
              parent.Add(new TreeNode(string.Format(&quot;{0}: {1}&quot;, name, ((JValue)token).Value)));
          }
          else if (token is JArray)
          {
              AddArrayNodes((JArray)token, name, parent);
          }
          else if (token is JObject)
          {
              AddObjectNodes((JObject)token, name, parent);
          }
      }
      private static void AddArrayNodes(JArray array, string name, TreeNodeCollection parent)
      {
          var node = new TreeNode(name);
          parent.Add(node);
  
          for (var i = 0; i &lt; array.Count; i++)
          {
          AddTokenNodes(array[i], string.Format(&quot;[{0}]&quot;, i), node.Nodes);
          }
      }
  
  
  
  var @object = JObject.Parse(json);
          AddObjectNodes(@object, &quot;JSON&quot;, treeView.Nodes);
  </code></pre>
  <p>my problem is i am getting output like this</p>
  <p><a href="https://i.stack.imgur.com/addKr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/addKr.png" alt="Enter image description here" /></a></p>
  <p>I want the below list format. How do I handle JSON to get this data in <a href="https://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29" rel="nofollow noreferrer">C#</a> <a href="https://en.wikipedia.org/wiki/Windows_Forms" rel="nofollow noreferrer">Windows Forms</a>?</p>
  <p>I am using Newtonsoft <a href="https://www.newtonsoft.com/json/help/html/Introduction.htm" rel="nofollow noreferrer">Json.NET</a>. Is there a way to break it into an arraylist?</p>
  <pre><code>---Work requestname ( Story mapping)
  ---Work requestname ( Story mapping)
  ---Work requestname ( Issue Collector)
  ---Work requestname ( Issue Collector)
  </code></pre>
  <p>And so on for a different work request</p>
  <p>I am having a hard time generating a class for my JSON content. All online class generators generate a class for each project like I have project1, project2, and so on since my REST API will provide multiple projects and cannot create a class each time on the go.</p>
  <p><a href="https://stackoverflow.com/questions/22191167/convert-json-string-to-c-sharp-object-list">This guy has his class sorted</a>.</p>