Read JSON with Powershell
Get-Content -Raw -Path <my_json_file>.json | ConvertFrom-Json
Syntax:
$my_file = Get-Content -Raw -Path .\<my_json_file>.json | ConvertFrom-Json
or to separate for piping further
( Get-Content -Raw -Path .\<my_json_file>.json | ConvertFrom-Json )
Example:
Input JSON file
{
"fruit": "Apple",
"size": "Large",
"color": "Red"
}
Powershell Command
( Get-Content -Raw -Path .\fruit.json | ConvertFrom-Json )
Results
fruit size color
----- ---- -----
Apple Large Red