C# Language Getting Started: Json with C# Deserialization

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

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 ".DeserializeObject" deserializes 'jsonExample' into an "Author" object. This is why it is important to set the json variables in the classes definition, so the method access it in order to fill it.



Got any C# Language Question?