【自用代码】Json转对象

private static object JsonToObject(string jsonString, object obj)

{

     var serializer = new DataContractJsonSerializer(obj.GetType());

     var mStream = new MemoryStream(Encoding.UTF8.GetBytes(jsonString));

     return serializer.ReadObject(mStream);

} 

 

你可能感兴趣的:(json)