I have a function to return a json string in this format:
{"TownA":{"female":512,"male":468},"TownB":{"female":748,"male":845}}
I'd like to append the data to a CSV:
town, value, gender
TownA, 512, female
TownA, 468, male
TownB, 748, female
TownB, 845, male
I think I need to first convert it to a custom object, like this:
$Line= [pscustomobject] @{
'Town' = [STRING]""
'Value' = [FLOAT]""
'sex' = [STRING]""
}
But I'm not sure. How can append this data to my csv?