Answers for "parse json url with c#"

C#
0

parse json C#

dynamic stuff = JsonConvert.DeserializeObject("{ 'Name': 'Jon Smith', 'Address': { 'City': 'New York', 'State': 'NY' }, 'Age': 42 }");
string name = stuff.Name;
string address = stuff.Address.City;
// Or using Newtonsoft.Json.Linq 
dynamic stuff = JObject.Parse("{ 'Name': 'Jon Smith', 'Address': { 'City': 'New York', 'State': 'NY' }, 'Age': 42 }");
string name = stuff.Name;
string address = stuff.Address.City;
Posted by: Guest on August-05-2021
1

get json from url c#

Use the WebClient class in System.Net.
Keep in mind that WebClient is IDisposable, so you would probably add a using
statement to this in production code. This would look like:

using (WebClient wc = new WebClient())
{
   var json = wc.DownloadString("url");
}
Posted by: Guest on August-03-2021

C# Answers by Framework

Browse Popular Code Answers by Language