任何人都可以帮助C#上的JSON字符串解析吗?
我尝试从https://www.newtonsoft.com/json/help/html/DeserializeDataSet.htm
重现样本string json = @"{
'Table1': [
{
'id': 0,
'item': 'item 0'
},
{
'id': 1,
'item': 'item 1'
}
]
}";
dataSet = JsonConvert.DeserializeObject<DataSet>(json);
我收到例外:
JsonConvert.DeserializeObject异常 System.Runtime.Serialization.SerializationException:Member &#39;的XmlSchema&#39;没找到。 09-17 07:41:27.075 I / mono-stdout(3691):JsonConvert.DeserializeObject异常 System.Runtime.Serialization.SerializationException:Member &#39;的XmlSchema&#39;没找到。 在System.Runtime.Serialization.SerializationInfo.GetElement(System.String name,System.Type&amp; foundType)[0x00020] in &LT; 3fd174ff54b146228c505f23cf75ce71&GT;:0 在System.Runtime.Serialization.SerializationInfo.GetValue(System.String name,System.Type type)[0x0002e] in &LT; 3fd174ff54b146228c505f23cf75ce71&GT;:0 在System.Data.DataSet.DeserializeDataSetSchema(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext上下文, System.Data.SerializationFormat remotingFormat, System.Data.SchemaSerializationMode schemaSerializationMode)[0x000f5] in:0 在System.Data.DataSet.DeserializeDataSet(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext上下文, System.Data.SerializationFormat remotingFormat, System.Data.SchemaSerializationMode schemaSerializationMode)[0x00000] in:0 在System.Data.DataSet..ctor(System.Runtime.Serialization.SerializationInfo inf o,System.Runtime.Serialization.StreamingContext context,System.Boolean ConstructSchema)[0x00069] in :0 在System.Data.DataSet..ctor(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)[0x00000] in :0 at(wrapper dynamic-method)System.Object:lambda_method(System.Runtime.CompilerServices.Closure,object []) 在Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateISerializable (Newtonsoft.Json.JsonReader读者, Newtonsoft.Json.Serialization.JsonISerializableContract合同, Newtonsoft.Json.Serialization.JsonProperty成员,System.String id) [0x0015b] in:0 在Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject (Newtonsoft.Json.JsonReader reader,System.Type objectType, Newtonsoft.Json.Serialization.JsonContract合同, Newtonsoft.Json.Serialization.JsonProperty成员, Newtonsoft.Json.Serialization.JsonCo ntainerContract containerContract,Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue)[0x00347] in :0 在Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal (Newtonsoft.Json.JsonReader reader,System.Type objectType, Newtonsoft.Json.Serialization.JsonContract合同, Newtonsoft.Json.Serialization.JsonProperty成员, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue)[0x0006d] in :0 在Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader,System.Type objectType, System.Boolean checkAdditionalContent)[0x000db] in :0 在Newtonsoft.Json.JsonSerializer.DeserializeInternal(Newtonsoft.Json.JsonReader reader,System.Type objectType)[0x00053] 在: 0 在Newtonsoft.Json.JsonSerializer.Deserialize(Newtonsoft.Json.JsonReader reader,System.Type objectType)[0x00000] in:0 在Newtonsoft.Json.JsonConvert.DeserializeObject(System.String值,System.Type类型,Newtonsoft.Json.JsonSerializerSettings 设置)[0x0002d] in:0 在Newtonsoft.Json.JsonConvert.DeserializeObject [T](System.String值,Newtonsoft.Json.JsonSerializerSettings设置) [0x00000] in:0
缺少什么?我应该添加任何XML架构吗?