日期:2014-05-17 浏览次数:20824 次
"{\"total\": \"1\", \"page\": \"1\", \"records\": \"1\", \"rows\": [{\"id\":\"1000\",\"cMonitorAreaName\":\"天麻监测\",\"cMonitorAreaDesc\":\"湿度监测\",\"iParentMonitorAreaid\":\"1\",\"iPlantFieldId\":\"30\",\"cPlantFieldName\":\"tuty\",\"id_NodeId\":\"100\",\"iIotNodeTypeId\":\"101\",\"iMonitorAreaId\":\"1000\",\"cIotNodeName\":\"test\",\"NodeNetworkNo\":\"111\",\"NodeHostNo\":\"112\",\"NodeRemark\":\"gfsdg\",\"HistoryDataId\":\"1\",\"fMonitorDataValue\":\"456.0\",\"dMonitorDateTime\":\"2013-07-26 05:00:00.0\",\"HistoryNodeNetworkNo\":\"123\",\"HistoryNodeHostNo\":\"12\",\"iParameterTypeId\":\"99\",\"cParameterTypeName\":\"tweta\",\"cParameterTypeDesc\":\"tretsr\",\"iValueType\":\"2\",\"cSymbol\":\"df\",\"cIotNodeTypeName\":\"ttt\",\"cIotNodeTypeDesc\":\"tttttt\",\"NodeTypeRemark\":\"tttt\"}"
public static T parse<T>(string jsonstring)
{
try
{
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(jsonstring)))
{
return (T)new DataContractJsonSerializer(typeof(T)).ReadObject(ms);
}
}
catch (Exception e) { return default(T); }
}