To work with Json using C#, it is need to use Newtonsoft (.net library). This library provides methods that allows the programmer serialize and deserialize objects and more.
There is a tutorial if you want to know details about its methods and usages.
If you use Visual Studio, go to Tools/Nuget P...
Before reading some code, it is important to undersand the main concepts that will help to program applications using json.
Serialization: Process of converting a object into a stream of bytes that can be sent through applications. The following code can be serialized and converted into the previ...
You can receive a json from anywhere, a file or even a server so it is not included in the following code.
static void Main(string[] args)
{
string jsonExample; // Has the previous json
Author author = JsonConvert.DeserializeObject<Author>(jsonExample);
}
The method ".Dese...
This sample used to common function for all type object serialization and deserialization.
using System.Runtime.Serialization.Formatters.Binary;
using System.Xml.Serialization;
namespace Framework
{
public static class IGUtilities
{
public static string Serialization(this T obj)
...