如果将某些内容添加到JSON文件中,则添加文本部分C#

时间:2015-03-27 21:44:15

标签: c# json

我基本上有一个程序可以检查网站上的JSON文件。我希望能够在添加新对象时使用列表框添加对象,但我只知道如何单独添加每个对象。

                try
            {

                HttpWebRequest Request = (HttpWebRequest)WebRequest.Create("https://mining.bitcoin.cz/accounts/profile/json/" + APIKey);
                HttpWebResponse response = (HttpWebResponse)Request.GetResponse();
                Stream responseStream = response.GetResponseStream();
                StreamReader readStream = new StreamReader(responseStream, System.Text.Encoding.GetEncoding("utf-8"));
                String json = readStream.ReadToEnd();
                readStream.Close();
                var jo = JObject.Parse(json);
                uName.Text = ((string)jo["username"]);
                eRewards.Text = ((string)jo["estimated_reward"]);
                uRewards.Text = ((string)jo["unconfirmed_reward"]);
                cRewards.Text = ((string)jo["confirmed_reward"]);
                bRating.Text = ((string)jo["rating"]);
                bHashrate.Text = ((string)jo["hashrate"]);
                walletID.Text = ((string)jo["wallet"]);
            }
            catch (Exception)
            {

            }

        }
        else
        {
            MessageBox.Show("Input API Key", "Mining.BitCoin.Cz", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }

0 个答案:

没有答案