I got a question about How to use Powershell flatten a nested JSON and covert to CSV. Below is my JSON, which is a mail message log get from Office 365 with many users messages, I need to filter the columns, flatten and convert to CSV :
createdDateTime,
receivedDateTime,
from_name
from_adress
To_name_1
To_adress_2
To_name_2
To_adress_2
...
The "from" field has only one data. But the "toRecipients" is a array.
{
...
"createdDateTime": "xxxx-xx-xx",
"receivedDateTime": "xxxx-xx-xx",
"isRead": true,
"from": {
"emailAddress": {
"name": "John",
"adress": "john@onmicrosoftware.com"
}
},
"toRecipients": [
{
"emailAddress": {
"name": "Amy",
"adress": "Amy@onmicrosoftware.com"
}
},
{
"emailAddress": {
"name": "Amy",
"adress": "Amy@onmicrosoftware.com"
}
}
]
}