I'm taking over for a counterpart that previously handled all our automation and coding. I'm ramping up AFAP but PowerShell is a new beast for me. We currently have a system in place that retrieves JSON formatted data and stores it in a database. Management isn't technical and wants this data exported to a good old fashioned CSV. I can get the JSON data just fine but I'm totally lost on how to parse this stuff so that each key is its own cell with all the correct data associated. Here's a sample of the JSON:
"data" : [
{
"enabled" : "1",
"pending" : "0",
"rule" : {
"id" : "5",
"modify_by" : "administrator",
"modify_time" : "1646077685",
"modify_type" : "Edited",
"name" : "This is a test rule",
"ruleHash" : "e4da3b7fbbce2345d7772b0674a318d5",
"rule_data" : {
"action" : "alert",
"all_folders" : "false",
"appname" : "AppStor",
"profile" : [
"Test Profile"
],
"folders" : [
{
"full_path" : "Home",
"id" : "testuser",
"parents" : [
"#"
],
"pathId" : "__ROOT__",
"uid" : "testuser@internal.lab",
"user" : "tesuser@internal.lab"
}
],
"instance" : "devtest.internal.lab",
"notify" : {
"interval" : "-1",
"profile" : "false"
},
"ongoing" : "true",
"profile_id" : [
"3"
],
"retroactive" : "false",
"version" : 2
}
}
}]
If someone can help get me started (with either a real basic sample or a link to one) that'd be greatly appreciated. Pulling my hair out over here.