- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to convert JSON to CSV file using PowerShell?
To convert the JSON to the CSV format we need to first use the ConvertFrom-JSON command. For example, we have already JSON file present with us at the C:\temp\VMinfo.JSON location. We will first import this file and then convert it to CSV as shown below.
Get-Content C:\Temp\VMInfo.json | ConvertFrom-Json | Export-Csv C:\Temp\vminfo.csv -NoTypeInformation
Suppose you have cmdlet that produces output in the hash table format as shown below.
PS C:\> Get-AzVM -VMName TestMachine2k16 | Select -ExpandProperty Tags Key Value --- ----- For Ansible Patching_Day Sunday Application SecretTag Owner Chirag
So we first need to convert the hash output to the JSON format and then from the JSON, we can save the output to excel.
PS C:\> Get-AzVM -VMName TestMachine2k16 | Select -ExpandProperty Tags | ConvertTo-Json | ConvertFrom-Json | Export-Csv C:\temp\Vmtags.csv -NoTypeIn formation
- How to convert JSON file to CSV file using PowerShell?
- How to edit the CSV file using PowerShell?
- How to retrieve CSV file headers using PowerShell?
- How to append data into a CSV file using PowerShell?
- How to convert JSON object to Hashtable format using PowerShell?
- Convert CSV to JSON using the Jackson library in Java?
- How to create a CSV file manually in PowerShell?
- How to convert a JSON array to CSV in Java?
- How to convert the hashtable to the JSON format using PowerShell?
- Importing / Exporting CSV file in PowerShell
- How to Export and import CSV file manually in PowerShell?
- How to parse a CSV file using PHP
- Convert PDF to CSV using Python
- How to convert raw text to the CSV (Comma Separated Values) in PowerShell?