Last active
August 29, 2015 14:00
-
-
Save timheuer/2309e689a40a20f3e8c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JSON: | |
[ | |
{ | |
team: { | |
international_date: false, | |
is_coed: false, | |
team_name: "foo bar" | |
} | |
}, | |
{ | |
team: { | |
international_date: false, | |
is_coed: false, | |
team_name: "foo bar" | |
} | |
} | |
] | |
C# Class: | |
[JsonObject("team")] | |
public class Team | |
{ | |
[JsonProperty("international_date")] | |
public bool InternationalDate { get; set; } | |
[JsonProperty("is_coed")] | |
public bool IsCoed { get; set; } | |
[JsonProperty("team_name")] | |
public string TeamName { get; set; } | |
} | |
Code: | |
List<Team> teams = (List<Team>) Newtonsoft.Json.JsonConvert.DeserializeObject<List<Team>>(data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The JSON array is of anonymous objects each with a team object as a property. The list class needs to match, something like: