vaScriptSerializer js = new JavaScriptSerializer();
var temp1 = db.aaa.Join(db.bbb, t => SqlFunctions.StringConvert((decimal)t.id).Trim(), t1 => t1.id, (t, t1) => new
{
id = t.id,
text = t.name,
state = "closed",
children = new
{
id = t1.id + "1",
text = t1.text,
},
});
return js.Serialize(temp1);
this is my linq code, i want use jquery tree generate tree menu in web page.but linq generated data is
[{"id": 1, "text": "1", "state": "closed","children": {"id": "11","text": "a"}}]
i want generate
[{"id": 1, "text": "1", "state": "closed","children": [{"id": "11","text": "a"}]}]
the json lost one pair of brackets in children node. i want to ask how to modify the linq code to generate right json.