Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Prepare data for unittests. Deserialize JSON to object hierarchy. Take from http://stackoverflow.com/a/9988494/443366

View gist:4483835
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
void Main()
{
JsonConvert.DeserializeObject<Root>(testJson).Dump();
}
 
readonly string testJson =
"{\"Profile\": [{" +
" \"Name\":\"Joe\"," +
" \"Last\":\"Doe\"," +
" \"Client\":" +
" {" +
" \"ClientId\":\"1\"," +
" \"Product\":\"Apple\"," +
" \"Message\":\"Peter likes apples\"" +
" }," +
" \"Date\":\"2012-02-14\"" +
" }]" +
"}";
 
public class Root
{
public Profile[] Profile;
}
 
public class Profile
{
public string Name { get; set; }
public string Last { get; set; }
public Client Client { get; set; }
public DateTime Date { get; set; }
}
 
public class Client
{
public int ClientId;
public string Product;
public string Message;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.