110,539
社区成员
发帖
与我相关
我的任务
分享
{
"children":
[ {
"date_added": "13021725292433000",
"id": "121",
"name": "asp.net - How to implement a custom panel with INamingContainer? - Stack Overflow",
"type": "url",
"url": "http://stackoverflow.com/questions/3671712/how-to-implement-a-custom-panel-with-inamingcontainer"
},
{
"date_added": "13021968277554750",
"id": "122",
"name": "Control firefox bookmarks by sqlite",
"type": "url",
"url": "http://www.cnblogs.com"
} ],
"date_added": "13022224650424250",
"date_modified": "13027602398784788",
"id": "6",
"name": "asp.net\u63A7\u4EF6\u6280\u672F",
"type": "folder"
}
public class Data
{
public List<Data1> children { get; set; }
public string date_added { get; set; }
public string date_modified { get; set; }
public string id { get; set; }
public string name { get; set; }
public string type { get; set; }
}
public class Data1
{
public Data1(string date_added, string id, string name, string type, string url)
{
this.date_added = date_added;
this.id = id;
this.name = name;
this.type = type;
this.url = url;
}
public string date_added { get; set; }
public string id { get; set; }
public string name { get; set; }
public string type { get; set; }
public string url { get; set; }
}
string json = "{\"children\": [ {\"date_added\": \"13021725292433000\",\"id\": \"121\", \"name\": \"asp.net - How to implement a custom panel with INamingContainer? - Stack Overflow\",\"type\": \"url\",\"url\": \"http://stackoverflow.com/questions/3671712/how-to-implement-a-custom-panel-with-inamingcontainer\"}, {\"date_added\": \"13021968277554750\",\"id\": \"122\",\"name\": \"Control firefox bookmarks by sqlite\",\"type\": \"url\",\"url\": \"http://www.cnblogs.com\"}],\"date_added\": \"13022224650424250\",\"date_modified\": \"13027602398784788\",\"id\": \"6\",\"name\": \"asp.net\u63A7\u4EF6\u6280\u672F\",\"type\": \"folder\"}";
Data data = JsonConvert.DeserializeObject<Data>(json);
data.children.Add(new Data1("13021968277554750", "123", "asp.net mvc", "url", "http://asp.net.com"));
string newJson = JsonConvert.SerializeObject(data);//结果