I have a scenario where I read data(possibly jarray or jobject) from the different files and use them for different file operation which required data with exact precision. However, when I tried to parse the data from the file, all the decimals are rounding off.
Example:
"Price": {
"CurrencyId": 148,
"Sales": 1125.0000,
"Tax": 0.0000,
"Final": 1125.0000,
"Final1": 1125.0000,
"Discount": 0.0,
"Tip": 0.0,
"SSG": 0.0,
"RoundingCorrection": 0.0,
"DiscountedPrice": null,
"environmental_fee": 0.0,
"environmental_fee_label": null,
"can_be_waived": false
}
After Parsing:
"Price": {
"CurrencyId": 148,
"Sales": 1125.0,
"Tax": 0.0,
"Final": 1125.0,
"Final1": 1125.0,
"Discount": 0.0,
"Tip": 0.0,
"SSG": 0.0,
"RoundingCorrection": 0.0,
"DiscountedPrice": null,
"environmental_fee": 0.0,
"environmental_fee_label": null,
"can_be_waived": false
}
Code Snippet:
public JObject GetJsonData(String directory)
{
try
{
JObject jObject = JObject.Parse(File.ReadAllText(directory));
return jObject;
}
catch (Exception exp)
{
Console.WriteLine("Error Observed in file: "+ directory);
Console.WriteLine("Error at: "+ exp.Message);
Console.WriteLine("Error Stacktrace: "+ exp.StackTrace);
}
return null;
}
Is there any way to get exact data from the file without any truncate.