Skip to content

Instantly share code, notes, and snippets.

@CayasSoftware
Created March 26, 2014 17:52
Show Gist options
  • Save CayasSoftware/9789244 to your computer and use it in GitHub Desktop.
Save CayasSoftware/9789244 to your computer and use it in GitHub Desktop.
namespace jsontest
{
class MainClass
{
public static void Main( string[] args )
{
var value = new Root() { Foo = "Foo", Child = new Child { Foo = "Foo" } };
string message = JsonConvert.SerializeObject(value);
Debug.WriteLine(message);
var result = JsonConvert.DeserializeObject<Root>(message);
var result1 = JsonConvert.DeserializeObject(message, typeof(Newtonsoft.Json.Linq.JObject));
var r = JsonConvert.DeserializeObject(message, typeof(There.Root));
var remoteRoot = new There.Root();
JsonConvert.PopulateObject(message, remoteRoot);
Console.ReadKey();
}
}
public class Root
{
public string Foo { get; set; }
public Child Child { get; set; }
}
public class Child
{
public string Foo { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment