๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ‘จ๐Ÿผ‍๐Ÿ’ป๊ฐœ๋ฐœ/C#

C# - ๊ฐ„๋‹จํ•œ API ์š”์ฒญ & JSON ์ถœ๋ ฅ

by Janger 2022. 2. 2.
728x90
๋ฐ˜์‘ํ˜•
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using System.Net;
using Newtonsoft.Json.Linq;

namespace covidView
{
    public partial class Form1 : Form
    {
        private const string URL = "https://api.corona-19.kr/korea/beta/";
        private string api = "?serviceKey={Your_APIKEY}";
        public Form1()
        {
            InitializeComponent();

            Console.WriteLine("Hello world!");
            using (WebClient wc = new WebClient())
            {
                string res = new WebClient().DownloadString(URL + api);

                JObject json = JObject.Parse(res);

                Console.WriteLine(json["API"]);
            }
        }

    }
}

 

์ฐธ๊ณ : 

https://fors.tistory.com/446

 

C# ์ฃผ์†Œ์— ์š”์ฒญ ๋ณด๋‚ด๊ณ  json ๊ฐ’ ๋ฐ›๊ธฐ

using System.Net; namespace WindowsFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); button1.Click += request; } private void request(object sender, EventArgs e..

fors.tistory.com

https://stackoverflow.com/questions/22870624/convert-json-string-to-json-object-c-sharp

 

Convert JSON String to JSON Object c#

I have this String stored in my database: str = "{ "context_name": { "lower_bound": "value", "upper_bound": "value", "values": [ "value1", "valueN" ] } }" This string is already in the JSON forma...

stackoverflow.com

 

728x90
๋ฐ˜์‘ํ˜•