Skip to content

Instantly share code, notes, and snippets.

@blowsie
Forked from janbaer/gist:5045798
Created July 7, 2016 12:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blowsie/aa9997be62e8fbc6a991878c62b51590 to your computer and use it in GitHub Desktop.
Save blowsie/aa9997be62e8fbc6a991878c62b51590 to your computer and use it in GitHub Desktop.
Convert CSV to Json with powershell
param
(
[string] $inputFile,
[string] $outputFile
)
if (($inputFile -eq $null) -or ($outputFile -eq $null)) {
"usage: convert_csv_to_json.ps1 [inputFile] [outputFile]"
return;
}
elseif ((Test-Path $inputFile) -eq $false) {
"The file $inputFile doesnt exists!"
return;
}
Get-Content -path $inputFile | ConvertFrom-Csv -Delimiter ';' | ConvertTo-Json | Out-File $outputFile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment