Download JSON file and export it to csv

Burim Rama 21 Reputation points
2021-02-07T21:26:43.683+00:00

Hi

I need to download af JSON file through API and convert it to csv as i need to update some attributes in AD server, this need to download the file as schedule job every night.

Any idea ?

Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. vTech 6 Reputation points
    2021-02-07T21:37:50.197+00:00

    invoke-webrequest to start the download
    convertfrom-json to parse
    export-csv to create the csv


  2. Anonymous
    2021-02-08T05:21:32.123+00:00

    Hi,

    Here is an example

    $uri = 'https://.../data.json'  
    $file = 'D:\data.csv'  
    (Invoke-WebRequest -Uri $uri | ConvertFrom-Json)| Export-csv -Path $file -NoTypeInformation  
    

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.