Forum Discussion
Find below raw attachment.
Hi Rao,
Please try to provide the solution. I need it. Please find the raw request attachment.
Thanks & Regards,
Gangadhar Badagi
- Gangadhar8 years agoOccasional Contributor
Can you please advise how to take a list of values (e.g. in Excel) and then convert that to json array. I am getting values from excel in DataSource but I am unable to convert those values to json in request body editor.. Please find the attachments. in request body I need json like below
[
{
"tcId":"ab1",
"tcName":"ab1",
"tcDesc":"abc1",
"tcType":"Other",
"tcPriority":"Low"
}]
Can anybody help me to get json body as above?
Thanks & Regards,
Gangadhar Badagi
- zsousa8 years agoContributor
Gangadhar, the approach I took is not to build the JSON string on the fly, which can get tricky. Instead what I did is provide teh JSON string in my excel file and using place holders for the values. for instance:
so in my excel what I have is 5 columns,
column name tcId tcName requestcolumn value 1234 test1 [{"tcId":"<tcId>","tcName":"<tcName>","tcDesc":"<tcDesc>","tcType":"<tcType>","tcPriority":"<tcProperity>"}]
so basically what I do is go through each variable inside <> and replace it with the value under each column.
[
{
"tcId":"<tcId>",
"tcName":"<tcName>",
"tcDesc":"<tcDesc>",
"tcType":"<tcType>",
"tcPriority":"<tcProperity>"
}]
Related Content
- 3 years agoprasath_2k
- 6 months agomacheshmeh