Example #1
0
        private static void Main(string[] args)
        {
            var people = new List <Person>()
            {
                new Person()
                {
                    Name   = "ADAM",
                    Age    = 10,
                    Weight = 55.6
                },
                new Person()
                {
                    Name   = "ELA",
                    Age    = 20,
                    Weight = 57.6
                }
            };

            var jsonPeople = IJsonConverter <List <Person> > .ToJson(people);

            Console.WriteLine(jsonPeople);

            var peopleFromJson = IJsonConverter <List <Person> > .FromJson(jsonPeople);

            peopleFromJson.ForEach(Console.WriteLine);

            var jsonFilename = "people.json";

            IJsonConverter <List <Person> > .ToJsonFile(people, jsonFilename);

            var peopleFromJsonFile = IJsonConverter <List <Person> > .FromJsonFile(jsonFilename);

            peopleFromJsonFile.ForEach(Console.WriteLine);
        }