E
E
estry2020-07-13 22:24:47
JSON
estry, 2020-07-13 22:24:47

How to get all data from json c#?

Hello. I get data in Json. There are also arrays and lines and Inty.
Is there a way to display all data?

For example. In the data array we have data: price, color, size.
The output should output: data: price-50r | color-red | size-xs.

By class, I understand how to deserialize. I don't understand without them.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Q
Qualiant, 2020-07-14
@estry

Watch what you're doing. A.S.P.? winforms? WPF? Xamarin? What version of .NET?
And so, there is Json.NET (Newtonsoft.Json, 555 million downloads).
It can be like this:

string json = @"{""key1"":""value1"",""key2"":""value2""}";

var values = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(json);

Returns a dictionary of dictionaries, in theory.
Haven't tested it myself, but according to the comments on StackOverflow ( https://stackoverflow.com/questions/1207731/how-ca... ) it works.

F
freeExec, 2020-07-13
@freeExec

Do this in classes. Or you will get a Dictionary in which there is another Dictionary, and in it another and another.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question