How To Deserialize JSON to Dynamic With Dynamic Declarations in C#

Published: 25 December 2023
on channel: Code Maze
2,610
56

►► Check out our courses: https://bit.ly/cdmz-courses
►► Support us on Patreon and get the source code:   / codemaze  

In this video, we are going to learn how to deserialize JSON into a dynamic object in C#.
JSON deserialization in C# refers to the process of forming .NET objects from a JSON string. Most of the time, this means creating strongly-typed POCOs. However, there are certain situations when we may prefer flexibility over type inference.

For example, cherry-picking a small portion of JSON data, dealing with external JSON data whose structure is largely unknown or changes very often, etc. Dynamic deserialization comes into play in such cases. This does not necessarily mean the use of the language's inbuilt dynamic keyword. As we mentioned, there are other ways as well.

We have three path-ways to achieve this:
Use of dynamic declarations
Using Anonymous Object
Leveraging the power of JSON DOM

In this video, we will cover the first option, and in the next one, we will talk about the other two.

FOLLOW US ON SOCIAL MEDIA!
►►   / marinko-spasojevic  
►►   / codemazeblog  
►►   / codemazeblog  


Watch video How To Deserialize JSON to Dynamic With Dynamic Declarations in C# online without registration, duration hours minute second in high quality. This video was added by user Code Maze 25 December 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 2,610 once and liked it 56 people.