I type data in CSV using excel. I want to convert the CSV into a JSON that looks like this:
[
{
"Sr": 1,
"Name": ["Steven ", " Smith "],
"Age": 5
},
{
"Sr": 2,
"Name": ["Mark ", " Wood "],
"Age": 2
}
]
None of the online converters convert the CSV in a way where the values of the key 'Name' are within square brackets and double quotes separated by a comma like in the example above.
I tried using online converters to the above JSON to CSV to see how I should have the values in the CSV.
It turned out like this:
Sr,Name,Age
1,"Steven , Smith ",5
2,"Mark , Wood ",2
Now converting that into JSON again gives a result like this:
[
{
"Sr": "1",
"Name": "Steven , Smith ",
"Age": "5"
},
{
"Sr": "2",
"Name": "Mark , Wood ",
"Age": "2"
},
{
"Sr": ""
}
]
As you can see, it's not like the example at the top. That's how I need to data to be in the JSON. Any help would be appreciated. I simply want to type data in a CSV file and convert it into JSON whose data looks like the example at the top.
Thank you!