小编xav*_*gar的帖子

尝试使用json.Net反序列化json字符串时出错

当我尝试反序列化以下简单的json字符串时遇到一个奇怪的错误:

{ "items": [ "IZ01", "MTSQ", "VM16", "CR05" ]}
Run Code Online (Sandbox Code Playgroud)

我从json.net dll得到的错误如下:

Invalid property identifier character: &. Path '', line 1, position 2.
Run Code Online (Sandbox Code Playgroud)

完整堆栈跟踪如下:

at Newtonsoft.Json.JsonTextReader.ParseProperty() at Newtonsoft.Json.JsonTextReader.ParseObject() at Newtonsoft.Json.JsonTextReader.ReadInternal() at Newtonsoft.Json.JsonTextReader.Read() at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CheckedRead(JsonReader reader) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Metastorm.Runtime.Models.SIMSCommonLib.UtilitiesLib.JSONDeserialize(String jsonText, Type …
Run Code Online (Sandbox Code Playgroud)

c# json.net

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

c# ×1

json.net ×1