Easiest Way for CSV/JSON Conversion

dev

Powershell comes with lots of great cmdlets. In this post I’d like to show an easy way to convert CSV to JSON and vice versa.

CSV to JSON

Import-Csv /path/to/csv | ConvertTo-Json | Out-File /path/to/json

JSON to CSV

(Get-Content -Path /path/to/json -Raw | ConvertFrom-Json) | Export-CSV /path/to/csv -NoTypeInformation