stictt

json

Jun 16th, 2020
1,158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.97 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO;
  7. using BaseDataConect;
  8. using System.Net;
  9. using Newtonsoft.Json;
  10. using System.Net.Http;
  11. using Newtonsoft.Json.Linq;
  12.  
  13. namespace DataEve
  14. {
  15.     class Program
  16.     {
  17.         static string api = "https://esi.evetech.net/latest/markets/10000002/orders/?datasource=tranquility&order_type=all&page=10";
  18.         async static Task Main(string[] args)
  19.         {
  20.  
  21.             HttpClient httpClient = new HttpClient();
  22.             string request = api;
  23.             HttpResponseMessage response =
  24.                 (await httpClient.GetAsync(request)).EnsureSuccessStatusCode();
  25.             string responseBody = await response.Content.ReadAsStringAsync();
  26.  
  27.             JToken jArray = JToken.Parse(responseBody);
  28.             jArray.
  29.             List<Orders> orders = jArray.ToObject<List<Orders>>();
  30.         }
  31.  
  32.         static void TestJson()
  33.         {
  34.            
  35.         }
  36.  
  37.     }
  38.     public class Orders
  39.     {
  40.         public int duration { get => duration; set => duration = value; }
  41.         public bool is_buy_order { get => is_buy_order; set => is_buy_order = value; }
  42.         public string issued { get => issued; set => issued = value; }
  43.         public int location_id { get => location_id; set => location_id = value; }
  44.         public int min_volume { get => min_volume; set => min_volume = value; }
  45.         public int order_id { get => order_id; set => order_id = value; }
  46.         public float price { get => price; set => price = value; }
  47.         public string range { get => range; set => range = value; }
  48.         public int system_id { get => system_id; set => system_id = value; }
  49.         public int type_id { get => type_id; set => type_id = value; }
  50.         public int volume_remain { get => volume_remain; set => volume_remain = value; }
  51.         public int volume_total { get => volume_total; set => volume_total = value; }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment