0

I am having some issues DeSerializing the following Json, it runs, throws no errors however the props in the class are all null so it is obviously not working.

 { "realms":[ { "type":"pve", "queue":false, "status":true, "population":"medium", "name":"Malfurion", "slug":"malfurion" } ] }

The above JSON is the jsonResult string so string jsonResult = the above JSON

My code:

public class Realm
{

    public string type { get; set; }

    public bool queue { get; set; }

    public bool status { get; set; }

    public string population { get; set; }

    public string name { get; set; }

    public string slug { get; set; }

}
var realm = javaScriptSerializer.Deserialize<Realm>(jsonResult);

1 Answer 1

1

There are no props in the object because the object contains a single array with a single object in the array.

Sign up to request clarification or add additional context in comments.

1 Comment

internal class Realm { public string type { get; set; } public bool queue { get; set; } public bool status { get; set; } public string population { get; set; } public string name { get; set; } public string slug { get; set; } } internal class RootObject { public Realm[] realms { get; set; } }

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.