CSV to Json

Hello,
i have an excel file with 2 columns and multiple rows in it, i saved it as csv file using excel save as option, i imported that csv file using import-csv and stored it in a variable , when i try to convert that to json using convertto-json, it keeps throwing the error “ConvertTo-Json : The converted JSON string is in bad format.”
But when i convert it with -compress , it works but it looks ugly and not usable for me. Any help? is there a way to construct a json file from csv using the values stored in variable or is there a way to decompress the compressed json file to make it work

Hi,
Do you have headers in csv file? Do you specify delimiter when importing csv?

yes i have headers and even if i specify delimiters it does not work :frowning:

Can you show your csv file?

it has some values in it, if i edit those, excel restarts automatically :-o