Unable to format json output to nested-json in powershell

Refresh

April 2019

Views

3 time

0

I have a powershell json output in this format. { "Name": "web-app", "BuildingBlock": "create-web-app", "TemplateName": "qa-bb-create-web-app-V1.1.1", "TemplateID": 1809 }, { "Name": "web-app", "BuildingBlock": "destroy-web-app", "TemplateName": "qa-bb-destroy-web-app-V1.1.1", "TemplateID": 1810 }

What I need to do is get he first key value wherever it is duplicate take it as a common parameter and make the third keyvalue as the nested key and provide the fourth keyvalue as the value. SOmething like this. Can anyone provide the solution in powershell.

{ "web-app":{ "create-web-app":"1809", "destroy-web-app":"1810" }

B S

0 answers