S
S
Stepan Fedoseev2021-10-19 08:53:03
JSON
Stepan Fedoseev, 2021-10-19 08:53:03

How to selectively deserialize JSON?

There is a problem with deserializing complex Json files. I just can't understand how I can pull out an arbitrary value from a complex structure and work with it normally. For example, take a list of all "messages" (just them), and then access the rest of the values ​​in the style "message.from.lastname".

The "JsonConvert.DeserializeObject<>()" method converts everything at once and does not allow you to work correctly directly with values.

On the Internet, I did not find parsing of complex structures, only simple json.

According to the dynamyc-type, I didn’t understand how it works at all. Some kind of magic.

616e5cc019bff834114048.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-10-19
@vabka

I don’t see any point in parsing partially, but if you really want to:
JsonDocument
Utf8JsonReader
And here’s how to use them:
https://docs.microsoft.com/en-us/dotnet/standard/s...
Don’t even look at dynamic, it’s support from System.Text.Json was cut out

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question