Skip to content

Instantly share code, notes, and snippets.

@jeevan-vj
Created March 16, 2018 07:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeevan-vj/131ea9259ab5478473b42a648381774e to your computer and use it in GitHub Desktop.
Save jeevan-vj/131ea9259ab5478473b42a648381774e to your computer and use it in GitHub Desktop.
Read write json file in powershell
$filePath = "C:\jeevan\sample.json"
$file = ([System.IO.File]::ReadAllText($filePath) | ConvertFrom-Json)
Write-Host $file.property1
$file.property1 = Get-Random
$file | ConvertTo-Json | Out-File -FilePath $filePath -Encoding utf8 -Force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment