Deserialize JSON Data to Custom C# Class Objects using Newtonsoft.

preview_player
Показать описание
Deserialize your JSON Data into Custom C# Class Objects using Newtonsoft Deserialize Object.

GitHub Link


How to Deserialize JSON that contains ARRAYS to C#.

Deserialize JSON ARRAYS to C# using Newtonsoft.

Deserialize JSON Nested ARRAYS to C# using Newtonsoft.

Build C# classes to support JSON that contains ARRAYS.

Let's (Design|Code|MODEL) your C# Class Objects to Deserialize your (simple to complex) JSON, so you can successfully use Newtonsoft.JSON.JsonConvert.DeserializeObject(complexJSON);

4 Examples, from EASY to COMPREHENSIVE, teaching you the skills to design any C# object, or set of C# class objects, that will allow you to Deserialize any JSON. You will need this skill if you want to be able to use Newtonsoft DeserializeObject

If you are having any challenges to MODEL your C# objects to correctly Deserialize your JSON, you have to watch this video. The fourth example is a must, if you truly want to have all the skills necessary to own this.

Example 1 - introduces the process to model correctly.
Example 2 - introduces a few more wrinkles.
Example 3 - is tough, however, you'll have the skills to complete.
Example 4 - you are now the boss. congrats.

Stop getting these type errors:
a) The JSON value could not be converted to [boolean, array,integer, etc]

TimeLine
00:00 begin
00:08 Setup project - use newtonsoft
01:04 - Example One - easy
07:35 - Example Two - semi-easy
12:49 - Example Three - it's official, this is harder
19:53 - Example 4 - you have to watch this to master this topic.

#softwareNuggets, @SoftwareNuggets , #share_to_be_better
Рекомендации по теме
Комментарии
Автор

oh my dear god, I've watched like 30 different videos about how to deserialize a JSON properly, and this is the first one that explains it so well and so detailed. and not only a simple JSON, multiple difficulty levels. Just perfect man, thanks.

elaprimo
Автор

I've never seen better tutorial covering this topic, awesome. I was struggling a lot and it turned out to be quite easy - thanks

juruvaper
Автор

Hey Team, here is the source code to Example #4. Enjoy.

SoftwareNuggets
Автор

I do not usually comment on videos, but this one is just amazing, thank you so much

saidsabri
Автор

Man, you've got a gift. Extremely good tutorial.

michaelnimley
Автор

You finally helped me understand this after days of trying. Thank you for this video.

morg
Автор

Very good video! A couple things that may help others, though: you can shortcut the whole process by copying the JSON and going to your class in Visual Studio and clicking Edit > Past Special > Paste JSON as Classes. Boom, job done. Also, I don't think the comment about case sensitivity with properties is accurate, as I always go back through and change my properties to uppercase to keep them standardized.

twotinytrees
Автор

It's very interesting video, i really like it. Thank for shared this

radheshyamgupta
Автор

Very useful tutorial!! Really helped me with my dissertation, Thank you!

MrHussainx
Автор

Many thanks for this video, explanation is superb!
A question... How would you model it to allow null on any of these values?

frazd
Автор

Thank you very much, very well explained!

ionutcatalin
Автор

Can you Please answer this, how to write code in repository class joining all the classes that we created here

doondisanapala
Автор

Thank you for the video, you explained so perfect. Can you do extension of this tutorial? how to use LINQ and access the data from complex JSON through LINQ I am struggling to filter the data from JSON after it's deserialized and iterate the nested arrays

sandy_git
Автор

However, when you come to get 3rd party API, it is a different story. I have difficult to show the response as c# classes.

patyue
Автор

I’m writing a program where a new object is created and added to a list every time I click, then saved when another button is clicked. If I create a list of those objects can I then do a similar thing here and mash them all into one big json file?

To be more specific, it’s a school project where I’m making a golf app. Every time I click I need to store information about each shot (the surface type, the coordinates etc). But when I want to save it I want there to be “hole” : 1 followed by the list of shots as objects, then “strokes” : 5 for example. Is that possible?

thebulletkin
Автор

Do you think you could have added one class called "country" instead of "worldInvestor" and in this case "_accounts" will only have one property under it called "List<country> countries"

essamce
Автор

The attribute lets you change the name of the property in your class and still serialize/deserialize correctly.

notpumkin
Автор

And why doesn't it support BSON out of the box?

nickbarton
Автор

Hey awesome video man! Is there any chance you could show deserialization without console application but instead using Wpf App(.Net Framework)? Also I would love to see how you use CRUD operations and when you create something how you can store it in a JSON file.

Trunkss
Автор

But how can I deserialize json that looks like this [ {} ]

Mariannnnnnnnnnnnnnnnnnnnn
welcome to shbcf.ru