Created
December 10, 2021 17:04
-
-
Save timheuer/25f72e5f21c363f35a7e4800bc1a8d04 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See https://aka.ms/new-console-template for more information | |
using System.Net.Http.Json; | |
Console.WriteLine("Hello, World!"); | |
HttpClient http = new(); | |
var customers = await http.GetFromJsonAsync<List<Customer>>("https://excel2json.io/api/share/dcb51ae600934ecf93c02c9ffcda3c6f"); | |
foreach (var item in customers) | |
{ | |
Console.WriteLine(item.PostalCode); | |
} | |
Console.ReadLine(); | |
public record Customer | |
{ | |
public string CustomerID { get; set; } | |
public string CompanyName { get; set; } | |
public string ContactName { get; set; } | |
public string ContactTitle { get; set; } | |
public string Address { get; set; } | |
public string City { get; set; } | |
public string Region { get; set; } | |
public object PostalCode { get; set; } | |
public string Country { get; set; } | |
public string Phone { get; set; } | |
public string Fax { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment