Hi there, I’ve got a datatable that I’ve imported from CSV. A column in the table is an amount (Int32). When I serialize the dt, the result has the amount converted to a string. I’m using: “jsonConvert.SerializeObject(outputFinal)” for the conversion.
The dt is already converted to a Json Object, the problem is the “amount” property is showing “-200” as a string - I need it to be an int ie, -200 (no “”)
The strange thing is the amount is an int in the data table so I don’t understand why it’s being converted to a string.
Thanks - does that mean I need to iterate through the entire JsonObject and convert each value in the “amount” property one at a time, or is there a way to convert all the “amount” properties at once?
Hello @cnjackson
I tried your code jsonConvert.SerializeObject(outputFinal) and it is working fine.
Please make sure the datatype of column amount is integer and not string.
@cnjackson No need to convert it to data table .Just pass the text file and serialize and it will return an object. Then do this Convert.ToInt32(Jsonobject(“PropertyName”))