var mJObj = JObject.Parse(json);
var mName = (JArray)mJObj["Result"];
for(var i=0;i<mName.Count;i++)
{
var tmpObj = (JObject)mName[i];
var tmpID = (string)tmpObj["Id"];
}
var mSize = (int)mJObj["size"];
------解决方案--------------------
------解决方案--------------------
using System.Runtime.Serialization;
C# code
public string Serialize<T>(T data)
{
using (var memoryStream = new MemoryStream())
{
var serializer = new DataContractSerializer(typeof(T));
serializer.WriteObject(memoryStream, data);
memoryStream.Seek(0, SeekOrigin.Begin);
var reader = new StreamReader(memoryStream);
string content = reader.ReadToEnd();
return content;
}
}
public T Deserialize<T>(string xml)
{
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(xml)))
{
var serializer = new DataContractSerializer(typeof(T));
T theObject = (T)serializer.ReadObject(stream);
return theObject;
}
}
------解决方案--------------------