How to pass data from csv file to JSON | Selenium Forum
A
Ankit Lohia Posted on 26/06/2019

Hi I have a requirement where I Need to pass parametrized data stored in csv to a json array. How to achieve this

FOR E.G-> I need to pass different values of lat,lng from csv file.

{
"stops": [
{
"lat": 22.344674, "lng": 114.124651
},
{
"lat": 22.375384, "lng": 114.182446
}


]
}


A
Ashish Thakur Replied on 26/06/2019

Please share your query in the Query resolution section of the course you're referring to

 


A
Ankit Lohia Replied on 27/06/2019

This query is regarding Rest API that undergoes selenium datadriven framework.


A
Ashish Thakur Replied on 28/06/2019

Hello Ankit,

To achieve this you need to write your own custom code.

JsonObject and JsonArray

Alternatively, you can refer the page below as well.

https://stackoverflow.com/questions/22383093/java-application-that-converts-csv-to-json


A
Ankit Lohia Replied on 01/07/2019

Thanks sir..That would help a lot..