PowerTip: Read a JSON configuration file as a PowerShell object
Summary: Using the ConvertFrom-Json Cmdlet in PowerShell to read a JSON formatted file
Hey, Doctor Scripto! I’ve seen a lot of JSON files in use in Azure. I’m not very good with editing JSON properly. Is there an easy way to read this and at least edit it with PowerShell?
Most definitely my good friend. For the file below called “settings.json” you can convert it to a PowerShell Object for editing purposes using the following line. Once you have completed this, you can manipulate it like any other PowerShell Object.
$PowerShellObject=Get-Content -Path settings.json | ConvertFrom-Json
PowerShell, Doctor Scripto, Sean Kearney, PowerTip, JSON