开发者

JSON array deserialization -- is the order of elements always preserved?

When deserializing a JSON array in C#/.NET, is the order 开发者_如何学运维of elements always preserved?

Edit: The library currently being used is .NET 3.5's System.Runtime.Serialization.Json.DataContractJsonSerializer


Yes.

The JSON spec does specify that the order is preserved for arrays as they are an ordered collection of values: JSON.org


I would say it depends on implementation of your library of choice for the task. I your library documentation does not say anything on the matter, I would assume that it is implementation details and can not be trusted(can be changed in next version).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜