ID Name Questions
1 Test "Produto prefer":"Algodão","Plantou algodão":"Sim"
2 Testb "Produto prefer:"Feijão Buer","Plantou algodão":"Não"
3 Testc "Produto prefer":"Buer","Plantou algodão":"Jao"
4 Testd "Produto prefer":"Alaer","Plantou algodão":"Vio"
from the above i want output as follows
The above json string questions column, put into all the questions into column header in excel
ID Name Produto prefer Plantou algodão Produto prefer Plantou algodão Produto prefer Plantou algodão Produto prefer Plantou algodão
For the above my code as follows
int columnindex = 43;
foreach (DataRow row in dtFarmerFarmReports.Rows)
{
var dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(row["farm_detailsdata"].ToString());
string str = string.Empty;
List<string> lst = new List<string>();
lst.AddRange(dict.Values);
foreach (var data in dict)
{
columnindex++;
worksheet.Cells[2, columnindex].Value = data.Key;
}
}
Because of all id have same questions, i am getting all id questions using loop only answers will differ for all id.
from the above output how to remove the duplicates id questions and bind the answers for based on each id
Excepted output as follows
ID Name Produto prefer Plantou algodão
1 Test Algodão SIm
2 Testb Feijão Buer Nao
3 Testc Buer Jao
4 Testd Alaer Vio
from my above what changes i have to do to get the excepted output
What I have tried:
ID Name Questions
1 Test "Produto prefer":"Algodão","Plantou algodão":"Sim"
2 Testb "Produto prefer:"Feijão Buer","Plantou algodão":"Não"
3 Testc "Produto prefer":"Buer","Plantou algodão":"Jao"
4 Testd "Produto prefer":"Alaer","Plantou algodão":"Vio"
from the above i want output as follows
The above json string questions column, put into all the questions into column header in excel
ID Name Produto prefer Plantou algodão Produto prefer Plantou algodão Produto prefer Plantou algodão Produto prefer Plantou algodão
For the above my code as follows
int columnindex = 43;
foreach (DataRow row in dtFarmerFarmReports.Rows)
{
var dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(row["farm_detailsdata"].ToString());
string str = string.Empty;
List<string> lst = new List<string>();
lst.AddRange(dict.Values);
foreach (var data in dict)
{
columnindex++;
worksheet.Cells[2, columnindex].Value = data.Key;
}
}
Because of all id have same questions, i am getting all id questions using loop only answers will differ for all id.
from the above output how to remove the duplicates id questions and bind the answers for based on each id
Excepted output as follows
ID Name Produto prefer Plantou algodão
1 Test Algodão SIm
2 Testb Feijão Buer Nao
3 Testc Buer Jao
4 Testd Alaer Vio
from my above what changes i have to do to get the excepted output