Hi everyone, I want to convert DataSet to Json using newtonsoft. I converted it successfully but an issue here is the datatable with 0 rows are column less in json.
I'm getting the json like below, but I want to have dt_3 with its columns names.
What I'm doing is
- string json_withoutStoreDetails = JsonConvert.SerializeObject(dset, Newtonsoft.Json.Formatting.Indented);
- {
- "dt_1": [
- {
- "depid": 51.0,
- "DepName": "Honda",
- "Amount": 110.50
- },
- {
- "depid": 54.0,
- "DepName": "Toyota",
- "Amount": 100.60
- },
- {
- "depid": 56.0,
- "DepName": "Diahatsu",
- "Amount": 120.00
- },
- {
- "depid": 57.0,
- "DepName": "Bedford",
- "Amount": 380.00
- },
- ],
- "dt_2": [
- {
- "depid": 50,
- "DepName": "AlloyRims",
- "Amount": 21.50
- }
- ],
- "dt_3": [
-
- ],
- }