I am trying to parse JSON data from this API:
I wrote that on Main Form:
void button1_Click(object sender, EventArgs e)
{
using (var webClient = new System.Net.WebClient())
{
var json = webClient.DownloadString("URL");
var user = JsonConvert.DeserializeObject<User>(json);
MessageBox.Show(User.callsign);
}
}
And I created a class where I convert JSON data to strings with JSONProperty:
public class User
{
[JsonProperty("callsign")]
public string callsign { get; set; }
}
The problem is that when I try the MessageBox.Show(user.callsign) on the main form, I can´t. Because the button1 void is static and the callsign string is not. What can I do??
Regards!!