public static void Main(string[] args) { var doc = JSONParser.CreateParser().LoadFromFile("TestData\\object.json"); //JSONObjectLoader.CreateLoader().LoadObject( person, doc ); var person = JSONObjectLoader.CreateLoader().CreateObject <Person>(doc); Console.WriteLine(person); }
public void TestLoadObject() { var doc = JSONParser.CreateParser().LoadFromFile("TestData\\car.json"); var car = JSONObjectLoader.CreateLoader().CreateObject <Car>(doc); Assert.True(car.Color == "red"); Assert.True(car.wheels.Length == 4); }
public static void Main(string[] args) { var doc = JSONParser.CreateParser().LoadFromFile("car.json"); var car = JSONObjectLoader.CreateLoader().CreateObject <Car>(doc); Console.WriteLine("loaded a " + car.age + " years old, " + car.Color + " car"); Console.WriteLine("car has " + car.wheels.Length + " wheels"); foreach (var wheel in car.wheels) { Console.WriteLine("wheel " + wheel.location + " available: " + wheel.available); } Console.WriteLine("engine driven by " + car.engine.fuel); Console.Write("Press any key to continue . . . "); Console.ReadKey(true); }