Created
January 19, 2017 20:11
-
-
Save mythz/32518b6aea880c07d538fde1a974e0b8 to your computer and use it in GitHub Desktop.
Machine JSON DTOs
This file contains 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
using System.Linq; | |
using System.Collections.Generic; | |
using ServiceStack; | |
using ServiceStack.Text; | |
public class Dto | |
{ | |
public int SourceID { get; set; } | |
public Dictionary<int, MachineEntry> Machines { get; set; } | |
} | |
public class MachineEntry | |
{ | |
public Machine Machine { get; set; } | |
} | |
public class Machine | |
{ | |
public string Version { get; set; } | |
} | |
var json = "{\"SourceID\":\"4\",\"Machines\":{\"2017\":{\"Machine\":{\"Version\":\"501\"}}}}"; | |
var dto = json.FromJson<Dto>(); | |
dto.PrintDump(); | |
This file contains 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
<?xml version="1.0" encoding="utf-8"?> | |
<packages> | |
<package id="ServiceStack.Text" version="4.0.62" targetFramework="net45" /> | |
<package id="ServiceStack.Client" version="4.0.62" targetFramework="net45" /> | |
<package id="ServiceStack.Interfaces" version="4.0.62" targetFramework="net45" /> | |
</packages> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment