Hi,
I get excel file to user like this:

I need to import this data into JSON string.
Row 1 and 2 belong to same transaction TrnName 'xxxx Name' with 2 different accounts. So, accounts should go into JSON as:
{
"ClientName": "AAA"
"Type": "Distribution"
"Method": "wire"
Trn Name: "xxxx Name"
"Account#":"id=5188;id=5189"
}
how can I do this JSON String. Need to group rows together based on Trn Name column. Any lead is helpful.
TIA
PrathibaPosted Nov 19, 2024, 8:19 PM
Thank you Prasad and Jignesh. I will try and get back to you.
Prasad RaveendranPosted Nov 17, 2024, 2:44 PM
I'm just trying to replicate your expected response. Please do let me know if there are any specific queries
First, make sure to install
ClosedXMLandNewtonsoft.Json:Then, use the following code to read data from the Excel file, group it by the
Trn Namecolumn, and generate the required JSON output.Sample Json Output
Jignesh KumarPosted Nov 17, 2024, 7:17 AM
Hello,
You need to create below 2 classes to convert your flat data to group by,
Now get data from Excel sheet, Here I have created sample data using above class,
You will receive the JSON in the format shown above, which you can utilize as needed.