I need to import some JSON data am getting into my database. I'd like to use PowerShell and figured out a little, but I need help getting the final piece together.
Here is my existing PowerShell script.
Get-Content -Path "t:\1.json" |
ConvertFrom-Json |
Select-Object -expand data |
ConvertTo-Csv -NoTypeInformation |
Set-Content "t:\1.csv"
It does everything but doesnot get the badges details out in single cav along with user name. My question is, how can I get all details in single csv?
Here is my JSON data:
{
"data": [
{
"name": "Shiva",
"email": "[email protected]",
"organization": "Team",
"badges": {
"data": [
{
"name": "AWS Certified Developer",
"id": "001"
}
]
},
"id": "1001"
},
{
"name": "Rudra",
"email": "[email protected]",
"organization": "Team",
"badges": {
"data": [
{
"name": "Certified Google Associate Cloud Engineer",
"id": "006"
}
]
},
"id": "1002"
},
{
"name": "Alazar",
"email": "[email protected]",
"organization": "Team",
"badges": {
"data": [
{
"name": "Google Cloud Data Engineer Certified",
"id": "007"
},
{
"name": "Google Certified Professional Cloud Network Engineer",
"id": "008"
},
{
"name": "AWS Solution Architect",
"id": "009"
},
{
"name": "Certified Google Associate Cloud Engineer",
"id": "006"
}
]
},
"id": "1003"
}
]
}