In one of the Net API controllers, I have an action which sends the request to another third party API and after receiving a response it does some manipulation with the JSON data received and finally returns the response to the frontend application. Sample code is given below:
using (var client = new HttpClient())
{
var response = await client.GetAsync(_remoteServiceEndPoint + "student/" + id);
if (response.IsSuccessStatusCode)
{
var contentString = await response.Content.ReadAsStringAsync();
//do something with contents and finally return response to the caller
}
}
Now if the third party sends a JSON response which contains a number like 999999999999999.99
and the ReadAsStringAsync
executes in the above code snippet, it changes the value to 10000000000000000
. Which I don't want.
I would like to know why ReadAsStringAsync
is behaving like this.