S
S
Slavik Smirnov2017-04-29 11:13:11
JSON
Slavik Smirnov, 2017-04-29 11:13:11

C# and Json - How to write the received data to an array?

Hello! I'm just learning C#. For example, a Json file comes from the server with the following content:

{
"response": {
"count": 83,
"items": [11111111, 11111113, 11111110, 111111112, 111111137, 111111136, 111111107, 111111164, 111111168, 1111111948, 111111149, 1111111371, 11111111698, 1798911117, 1111111129, 1111111205, 111111199, 1911111115296, 199111111176, 20011111117, 21111111119, 2181111111519, 2202259, 21111111297, 224111111138, 228111111166, 21111111646, 23111111179, 1111111, 24111111127, 11111114521, 248111111163, 2111111195, 111111147, 21111111816, 211111118, 211111119, 274537989, 279062466, 279887191, 28111111160, 294604989, 1111111080, 296734230, 299226796, 31111111170, 3111111114989, 311111111131, 3111111120, 319464615, 311111114247, 323328445, 329189573, 335387039, 1111111261, 31111111049, 31111111152, 11111111734, 11111113868, 348908268, 111111140, 36111111116, 362794942, 370086175, 1111111122, 372851861, 373167470, 37111111134, 373982554, 11111113, 377335173, 378418036, 379900852, 380295532, 111111168, 385568244, 11111116, 111111189361, 3111111165, 398418316, 39111111168, 403098491, 1111111975]
}
}

All numbers are invented.
How to write them to an array?
I will be grateful for the answer

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Usotsky, 2017-04-29
@fooxboy

There is a Json NetWork library that solves these problems.
You will have something like this data structure:

public struct Top
{
    public Response response;
    
    public struct Response
    {
        public int count;
        public int[] items;
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question