title: How to create json file
body: <p>I have write a C# Program to Generate "Json" File for Eway Bill Uploading</p>
  
  <p>My Json Format is :- (Its not working When I upload in EwayBill)</p>
  
  <p>Please help me,how to do this</p>
  
  <pre><code>[{"Supply Type":"Outward","Sub Type":"Export","Doc Type":"Tax Invoice","Doc No":"PK/18/0015","Doc Date":"16/02/2018 00:00:00","From_OtherPartyName":"KH Exports  India Private Limited Glove Division","From_GSTIN":"33AAACR1714R1ZA","From_Address1":"142/1,Trunk Road","From_Address2":"Perumugai","From_Place":"Vellore","From_Pin Code":"632009","From_State":"Tamil Nadu","To_OtherPartyName":"K H EXPORTS INDIA PRIVATE LIMITED","To_GSTIN":"33AAACR1714R1ZA","To_Address1":"GLOVE DIVISION, GODOWN","To_Address2":"NEW NO. 24, KUMARAPPA STREET,","To_Place":"Chennai","To_Pin Code":"600003","To_State":"Tamil Nadu","Product":"FINISHED LEATHER GLOVES FOR LADIES","Description":"","HSN":"42032920","Unit":"PAIRS","Qty":"25","Assessable Value":"678","Tax Rate (S+C+I+Cess)":"9+9+0+0","CGST Amount":"6102","SGST Amount":"6102","IGST Amount":"0","CESS Amount":"0","Trans Mode":"Road","Distance (Km)":"115","Trans Name":"","Trans ID":"","Trans DocNo":"","Trans Date":"","Vehicle No":"TN23CB8274","Errors List":""}]
  </code></pre>
  
  <p>The below json is working fine (I get this json from eway bill website)</p>
  
  <pre><code>{
  "version":"1.0.0123",
      "billLists":[{
             "userGstin":"29BQSPA3829E124",
             "supplyType":"O",
             "subSupplyType":1,
             "docType":"INV",
             "docNo":"1234",
             "docDate":"04/03/2017",
             "fromGstin":"29BQSPA3829E124",
             "fromTrdName":"HUKKERI PVT LTD",
             "fromAddr1":"OLD AIRPORT ROAD",
             "fromAddr2":"OLD AIRPORT ROAD",
             "fromPlace":"BANGALORE",
             "fromPincode":560090,
             "fromStateCode":29,
             "toGstin":"29AAACG0569P1Z3",
             "toTrdName":"AMBUJA PVT LTD",
             "toAddr1":"MG ROAD",
             "toAddr2":"MG ROAD",
             "toPlace":"BANGALORE",
             "toPincode":560090,
             "toStateCode":29,
             "totalValue":678,
             "cgstValue":6102,
             "sgstValue":6102,
             "igstValue":0,
             "cessValue":0,
             "transMode":1,
             "transDistance":567,
             "transporterName":"",
             "transporterId":"",
             "transDocNo":"",
             "transDocDate":"",
             "vehicleNo":"KA12KA1234",
                       "itemList":[{
                              "itemNo":1,
                              "productName":"STEEL",
                              "productDesc":"STEEL",
                              "hsnCode":26180000,
                              "quantity":0,
                              "qtyUnit":"KGS",
                              "taxableAmount":678,
                              "sgstRate":9,
                              "cgstRate":9,
                              "igstRate":0,
                              "cessRate":0
                            }
  
                            ]
             }
  
        ]
  }
  </code></pre>
  
  <p>I have tried below but its not solved...please check this code...</p>
  
  <pre><code>public bool WriteJason(DataTable dt, string path)
      {
          try
          {
  
              System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
              List&amp;lt;Dictionary&amp;lt;string, string&gt;&gt; rows = new List&amp;lt;Dictionary&amp;lt;string, string&gt;&gt;();
              Dictionary&amp;lt;string, string&gt; row = null;
  
              foreach (DataRow dr in dt.Rows)
              {
                  row = new Dictionary&amp;lt;string, string&gt;();
                  foreach (DataColumn col in dt.Columns)
                  {
                      row.Add(col.ColumnName.Trim().ToString(), Convert.ToString(dr[col]));
                  }
                  rows.Add(row);
              }
              string jsonstring = serializer.Serialize(rows);
  
              using (var file = new StreamWriter(path, false))
              {
                  file.Write(jsonstring);
                  file.Close();
                  file.Dispose();
              }
              return true;
          }
          catch { return false; }
      }
  </code></pre>