I have this code that calls up a PHP that returns a Json
string str = "https://url/file.php";
string[] cID = new string[] { "act=qwjFpPXuGexZBHDJEreZrAUH&CID=", "&username=", Username, "&password=", Password };
string str1 = string.Concat(cID);
using (WebClient webClient = new WebClient())
{
webClient.Proxy = null;
webClient.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
string str2 = webClient.UploadString(str, str1).Replace("\r", "").Replace("\n", "").Trim();
JsonConvert.DeserializeObject<List<Information>>(str2);
str2 returns this Json
[{"username":"xxxxxx","email":"[email protected]","plan":"0","activationdate":"","terminationdate":""}]
Which is what I want but when i try to pass it to this class it sends nothing:
public class Information
{
public string ID { get; set; }
public string username { get; set; }
public string email { get; set; }
public string plan { get; set; }
public string activationdate { get; set; }
public string terminationdate { get; set; }
public Information()
{
}
}
And if I try to do this
label11.Text = Information.username;
I get "null" on the label and this error: An object reference is required for the nonstatic field, method, or property.
What am I doing wrong and how can I deserialize correctly to the class to be able to show the contents of the class into the labels?.