I'm trying to get the "Last" Object from this api in C#: https://bittrex.com/api/v1.1/public/getmarketsummary?market=usdt-btc
I already have the script to get the array into my C# code but i don't know how to get this Object, i have googled around for help and i found things like these: https://www.codementor.io/andrewbuchan/how-to-parse-json-into-a-c-object-4ui1o0bx8 but it did not work for me.
EDIT The working version is here: http://dotnetfiddle.net/5VFof9
//GET api array
string GET(string url) {
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
try {
WebResponse response = request.GetResponse();
using (Stream responseStream = response.GetResponseStream()) {
StreamReader reader = new StreamReader(responseStream, Encoding.UTF8);
return reader.ReadToEnd();
}
} catch (WebException ex) {
WebResponse errorResponse = ex.Response;
using (Stream responseStream = errorResponse.GetResponseStream()) {
StreamReader reader = new StreamReader(responseStream, Encoding.GetEncoding("utf-8"));
String errorText = reader.ReadToEnd();
// log errorText
}
throw;
}
}
decimal coin_price() {
String array = GET("https://bittrex.com/api/v1.1/public/getmarketsummary?market=usdt-btc");
decimal price = 0;
//return price in price var
return price;
}
private void Form1_Load(object sender, EventArgs e) {
price.Text = ""; //Display price here
}