So i am trying to get the values from this JSON file the json file
{ "Global Quote": { "01. symbol": "IBM", "02. open": "125.8300", "03. high": "126.2500", "04. low": "123.4000", "05. price": "124.1500", "06. volume": "3115104", "07. latest trading day": "2020-06-17", "08. previous close": "125.1500", "09. change": "-1.0000", "10. change percent": "-0.7990%" } }
i tried to create class with special paste in visual studio and it gave a result like this:
public class Rootobject
{
public GlobalQuote GlobalQuote { get; set; }
}
public class GlobalQuote
{
public string _01symbol { get; set; }
public string _02open { get; set; }
public string _03high { get; set; }
public string _04low { get; set; }
public string _05price { get; set; }
public string _06volume { get; set; }
public string _07latesttradingday { get; set; }
public string _08previousclose { get; set; }
public string _09change { get; set; }
public string _10changepercent { get; set; }
}
WebClient webClient = new WebClient();
string result = webClient.DownloadString("URL Source");// the result is the json file
GlobalQuote m = JsonConvert.DeserializeObject<GlobalQuote>(result);
Console.WriteLine(m._01symbol);
Console.WriteLine(m._02open);
Console.WriteLine(m._03high);
it gave me nothing. i think the problem is that the attributs in the class does not match with JSON file. the problem that the attributs in the JSON file contains space. So i am searching for a solution to get values from JSON file without using class. Can anyone help me please and thanks in advance.