0

I am using the code provided by @Parijat in this question to parse XLSX data into JSON format. I have some columns that contain multiple values per cell separated by commas and I would like have these formatted as arrays of strings in the JSON output.

For example:

id    Conditions 
1     influenza,asthma
2     influenza
3     high-blood pressure, influenza

I would like the JSON to be:

{
"id":1,
"conditions":["influenza", "asthma"]
},
{
"id":2,
"conditions":["influenza"]
}.
{
"id": 3,
"conditions":["high-blood pressure","influenza"]
}

Could someone be kind enough to show me how to adapt the code in the other question to produce JSON like this?

If it helps, I know in advance which columns need to be output as an array, so I have their column indexes, or could move them all to the start or end of the xlsx file.

stanley
  • 177
  • 8

0 Answers0