I'm using .NET Core for Linux for a Console Program. Using Http functionality I'm get some information coming from a Webservice. Then I'm trying to cast the result to an object but I'm not able to use JSON.
I read this article but I don't find any example and I don't have access to JavaScriptSerializer
public async void CallApi(Object stateInfo)
{
var client = new HttpClient();
var requestContent = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("pair", "XETHZEUR"), });
HttpResponseMessage response = await client.PostAsync("https://api.kraken.com/0/public/Trades", requestContent);
HttpContent responseContent = response.Content;
using (var reader = new StreamReader(await responseContent.ReadAsStreamAsync()))
{
String result = await reader.ReadToEndAsync();
//Here I would like to do a deserialized of my variable result using JSON (JObject obj = (JObject)JsonConvert.DeserializeObject(result);) But I don't find any JSON object
}
}
EDIT I would like to know how can I use JSON to convert my variable result to an object like I do usually with c#:
JObject obj = (JObject)JsonConvert.DeserializeObject(result);
I hope you will be able to help me.
Many thanks,