标签:
1、Json反序列化为对象,再通过where条件查询集合中的某条信息 反序列化需引用LitJson.dll
List<City> List_City = JsonMapper.ToObject<List<City>>(city_json_info);
var list = List_City.Where(m => m.name == SignCity);
IList<City> IList_City = list.ToArray();
string City_Spell = "";
foreach (var item in IList_City)
{
City_Spell = item.pinyin;
}
2、得到集合中的某些列
IList<OperaterInfo> resultOpers = client.GetSubEmpsForPage(parms, values, pageNum, pageSize);
int count = client.GetSubEmpsRowCount(parms, values);
var list = resultOpers.Select(m => new
{
m.DepName,
m.LoginName,
m.OptId,
RoleName = string.Join(",", m.Roles.Select(r => r.RoleName)),
m.Name
});
3、将对象转为Json 需引用Nettonsoft.Json.dll
string strJson = JsonConvert.SerializeObject(Class_BIGBODY);
//Json转XML
XmlDocument xmlDoc = JsonConvert.DeserializeXmlNode(strJson);
标签:
原文地址:http://www.cnblogs.com/weijiafd/p/4627666.html