- JScript code
[{ "娱乐热门": [{ "name": "房间名", "id": 1 },{ "name": "房间名", "id": 1 } ] },{ "游戏热门": [{ "name": "房间名", "id": 1 },{ "name": "房间名", "id": 1 } ] }, { "特色推荐": [{ "name": "房间名", "id": 1 },{ "name": "房间名", "id": 1 } ] }]
初学json 请大家帮助下
------解决方案--------------------------------------------------------
用一个对象列表
public class Category
{
Name {get;set;}
IList<Room> Rooms {get;set;}
}
public class Room
{
Name {get;set}
ID {get;set;}
}
给IList<Category>赋值,再用Newtonsoft.Json来生成就行了
------解决方案--------------------------------------------------------
javascriptserializer此了可完成此功能,没必要用外挂:
http://msdn.microsoft.com/zh-cn/library/system.web.script.serialization.javascriptserializer.aspx
------解决方案--------------------------------------------------------
------解决方案--------------------------------------------------------