Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }