H
H
HoShik2021-11-24 17:29:36
C++ / C#
HoShik, 2021-11-24 17:29:36

What happens when you deserialize an empty list?

There is json

{
list: []
}

There is a ListInfo class with a field When deserializing the above specified json, ListInfo.list will be null? Also what will be if to serialize ? Json specified by me?
List<long> list { get; set; }
List<long> list = new List<long>();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-11-24
@HoShik

With standard settings:
1. When deserializing, you will get an empty list
2. When serializing, you will get json from the example.
It is very easy to check on your own, the computer will not break from this.
https://dotnetfiddle.net/Nsf8Bb
And it would be faster than asking a question here, I think.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question