Export Json to Csv in PowerShell

In Big-data era, the data are stored in flat files which is supporting wider range of technology and systems. Json is serialized data to feeds into multiple development language and automation scripts in devOps system. Export Json to Csv would common question whoever doing data across platform, here are the simple script to claim your times.

Despite data needs to insert into MSSQL in Azure DB so converting to Csv.

Example 01

If the Json has a header and value that required to -Join. Below Servers json data file has columns and values.

PowerShell to ConvertFrom-Csv

Example 02

Play with Export-Csv to save the file

PowerShell – Export list value directly to csv with out join comment.

Export-Csv -UseQuotes AsNeeded work in PowerShell v6 and higher. So download and install latest version from MS git release.

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.