/// <summary>
/// JSON反序列化 json->对象
/// </summary>
public static Object Jsons(string jsonString)
{
JavaScriptSerializer jsonSerialzer = new JavaScriptSerializer();
Object retObj = jsonSerialzer.Deserialize<Object>(jsonString);
return retObj;
}
/// <summary>
/// JSON 序列化 对象->json
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public static string ObjGOJsons(Object obj) {
JavaScriptSerializer jsonSerialzer = new JavaScriptSerializer();
string retJson = jsonSerialzer.Serialize(obj);
return retJson;
}
这是json 转换object 和object 转json 的
using Newtonsoft.Json;
using System.Web.Script.Serialization;