none
Json Convert RRS feed

  • Genel Tartışma

  • Aşağıdakı kod Json datal
    using Newtonsoft.Json;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.IO;
    using System.Linq;
    using System.Net.Http;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    
    namespace WindowsKoineks
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri("https://koineks.com/ticker");
    
                client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage cevap = client.GetAsync("").Result;
                if (cevap.IsSuccessStatusCode)
                {
                    string data = cevap.Content.ReadAsStringAsync().Result;
                    BTC BTCParite = JsonConvert.DeserializeObject<BTC>(data);
                    label1.Text = BTCParite.short_code;
                      
                
                }
            }
           
    
        
        }
    }
    
    
    // Classı
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace WindowsKoineks
    {
        //class KoineksApiRead
        //{
        //}
    
        public class BTC
        {
            public string short_code { get; set; }
            public string name { get; set; }
            public string currency { get; set; }
            public string current { get; set; }
            public string change_amount { get; set; }
            public int change_percentage { get; set; }
            public string high { get; set; }
            public string low { get; set; }
            public string volume { get; set; }
            public string ask { get; set; }
            public string bid { get; set; }
            public int timestamp { get; set; }
        }
    
        public class ETH
        {
            public string short_code { get; set; }
            public string name { get; set; }
            public string currency { get; set; }
            public string current { get; set; }
            public string change_amount { get; set; }
            public int change_percentage { get; set; }
            public string high { get; set; }
            public string low { get; set; }
            public string volume { get; set; }
            public string ask { get; set; }
            public string bid { get; set; }
            public int timestamp { get; set; }
        }
    
        public class LTC
        {
            public string short_code { get; set; }
            public string name { get; set; }
            public string currency { get; set; }
            public string current { get; set; }
            public string change_amount { get; set; }
            public int change_percentage { get; set; }
            public string high { get; set; }
            public string low { get; set; }
            public string volume { get; set; }
            public string ask { get; set; }
            public string bid { get; set; }
            public int timestamp { get; set; }
        }
    
        public class DOGE
        {
            public string short_code { get; set; }
            public string name { get; set; }
            public string currency { get; set; }
            public string current { get; set; }
            public string change_amount { get; set; }
            public int change_percentage { get; set; }
            public string high { get; set; }
            public string low { get; set; }
            public string volume { get; set; }
            public string ask { get; set; }
            public string bid { get; set; }
            public int timestamp { get; set; }
        }
    
        public class DASH
        {
            public string short_code { get; set; }
            public string name { get; set; }
            public string currency { get; set; }
            public string current { get; set; }
            public string change_amount { get; set; }
            public int change_percentage { get; set; }
            public string high { get; set; }
            public string low { get; set; }
            public string volume { get; set; }
            public string ask { get; set; }
            public string bid { get; set; }
            public int timestamp { get; set; }
        }
    
        public class XRP
        {
            public string short_code { get; set; }
            public string name { get; set; }
            public string currency { get; set; }
            public string current { get; set; }
            public string change_amount { get; set; }
            public int change_percentage { get; set; }
            public string high { get; set; }
            public string low { get; set; }
            public string volume { get; set; }
            public string ask { get; set; }
            public string bid { get; set; }
            public int timestamp { get; set; }
        }
    
        public class XLM
        {
            public string short_code { get; set; }
            public string name { get; set; }
            public string currency { get; set; }
            public string current { get; set; }
            public string change_amount { get; set; }
            public int change_percentage { get; set; }
            public string high { get; set; }
            public string low { get; set; }
            public string volume { get; set; }
            public string ask { get; set; }
            public string bid { get; set; }
            public int timestamp { get; set; }
        }
    
        public class XEM
        {
            public string short_code { get; set; }
            public string name { get; set; }
            public string currency { get; set; }
            public string current { get; set; }
            public string change_amount { get; set; }
            public int change_percentage { get; set; }
            public string high { get; set; }
            public string low { get; set; }
            public string volume { get; set; }
            public string ask { get; set; }
            public string bid { get; set; }
            public int timestamp { get; set; }
        }
    
        public class RootObject
        {
            public BTC BTC { get; set; }
            public ETH ETH { get; set; }
            public LTC LTC { get; set; }
            public DOGE DOGE { get; set; }
            public DASH DASH { get; set; }
            public XRP XRP { get; set; }
            public XLM XLM { get; set; }
            public XEM XEM { get; set; }
        }
    }
    
    

    arı boş döndüyüyor. Yardımcı olursanız memnuın olurum
    7 Mart 2018 Çarşamba 11:05