I have .csv files containing long numbers. I used the following PowerShell script to convert from .csv file to .json. But the long numbers are importing as scientific notation.
How to force import long number from csv to json without converting to scientific notation?
Here is my PowerShell script,
import-csv -path "F:\DATA_002.csv" -UseCulture | select "Name", "Mobile", "Other mobile no." | ConvertTo-Json | Add-Content -Path "F:\DATA_002.json"
As mclayton astutely pointed out in a comment, you may not be able to get the original number back however if you just want to get rid of the scientific notation you can try either of the following:
Both use converting the scientific notation text to a long object type using the
-asoperator.A word of caution when using the
-asoperator. If the conversion fails, it will do so silently and the output will be null. If you'd rather it fail with notification, try casting the value to long rather than using-as