Newtonsoft.Json: Serialize objects
Create a C# program to serialize and deserialize objects in JSON format. For this you can use the
JsonConvert class included in the
To install the library in VS Code you can run
dotnet add package Newtonsoft.Json in terminal.
First implement a Person class with three properties (Name, Age and City). The City class will have two properties (Name and Population). Then create a person object and use the
JsonConvert object's serializer to save the data in a .json file, later deserialize the.json file and print it on screen. Remember to prepare a
ToString () method to print the Persona class.