1
I’m having trouble doing the post in my API my app up to register the object but then it locks the application and closes with this error of execution:
Newtonsoft.Json.Jsonreaderexception: Unexpected Character encountered while Parsing value: {. Path '', line 1, position 1.
public async Task<int> AddFrutas(Fruta fruta)
{
HttpClient client = new HttpClient();
var data = JsonConvert.SerializeObject(fruta);
var content = new StringContent(data, Encoding.UTF8, "application/json");
var response = await client.PostAsync("http://nivelamento.gopagoda.io/api/frutas", content);
var result = JsonConvert.DeserializeObject<int>(response.Content.ReadAsStringAsync().Result);
return result;
}
You can add the serialized date value, please?
– Aline
"name": "Banana", "vitamin": "E", @Aline
– rodrigo.oliveira
What about the value of Sponse?
– Aline
@Aline, I managed to solve I already put the answer down.
– rodrigo.oliveira