Convert csv to json in powershell.

Job ID: 30824992

Budget: ₹100 – ₹400 INR

HI, I am Bikash, I am a student. As per my regular task , i got some issue that, unable to convert the csv file to json format.

Script -
import-csv "C:\Users\Desktop\ps\VM details" | ConvertTo-Json | Add-Content -Path "C:\Users\Desktop\ps\output.json"

While run this script , out put is not correct as am getting null values.
Could you please help me on this ?


================Expectation output should like below ===============
[
{
"VM Name": "bratsc01",
"Disk Path": "/", "/common", "/common/vdisk_mnt",
"NIC card": "2",
"Disk Capacity": "5.62","43.81", "15.62"

},
{
"VM Name": "bratsc02a",
"Disk Path": "/", "/boot", "/tmp", "/config_bak", "/config", "/var/dump", "/var/log",
"NIC card": "2",
"Disk Capacity": "10.19", "0.92", "10.19", "3.69", "28.94", "28.94", "9.25"


}
]
======================================================
Related categories: Powershell