I am using powershell to get some data from a webservice which is returning json.
I wish to write this out to a CSV file, but not sure how to do it.
So far:
$webRequest = [System.Net.WebRequest]::Create( $loc ) $webRequest.Headers.Add($auth2) $return = $webRequest.GetResponse() # $usagein = Invoke-WebRequest -Uri $loc -Headers @{"authentication"=$authent} -timeoutsec 6000 | ConvertFrom-Json $stream = $return.getResponseStream() $sr = new-object IO.StreamReader($stream) $result = $sr.ReadToEnd() $return.close() $resultjson = $result | ConvertFrom-Json $result > ".\output_normal.txt" $resultjson > ".\output_json.txt" write-host "done for" $beginrange $endrange
I end up with two files, one with the raw output and one with nicly formatted Json.
How can I write to a CSV file?
Thanks.