Create json file in C#

Ok so I did need an array!

image

dynamic jsonData; 
dynamic projRow;

var tt = ttCustomer.FirstOrDefault();
if(tt != null )
{
 jsonData = new JObject();
 jsonData.projRow = new JArray() as dynamic;

  var list = (from oh in Db.OrderHed.With(LockHint.NoLock)
              where oh.Company == Session.CompanyID && oh.BTCustNum == tt.CustNum  && oh.OpenOrder && oh.ShortChar01 != ""
              select new {oh.ShortChar01} ).ToList();

  foreach(var result in list)
  {    
    projRow = new JObject();
    projRow.ProjID = result.ShortChar01;
    projRow.CreditLimit = tt.CreditLimit;
    projRow.CustType_c = tt["CustType_c"];
    jsonData.projRow.Add(projRow);
  } 

    string jsonDataDebug = JsonConvert.SerializeObject(jsonData);     
    Debug = jsonDataDebug;
3 Likes