I have a problem to serialize a json from a list of object
My goal is to have this format =>
var tag =
{
RCP: {name: "Dossier à présenter en RCP", type: "checkbox", events: {change: function(e) { console.log(e.data); console.log(e); } }, callback: function(key, opt){ console.log("key : " + key); console.log(opt); alert(opt.$trigger.attr("id")); }},
COL: {name: "Dossier à présenter en colloque", type: "checkbox", callback: function(key, opt){ console.log("key : " + key); console.log(opt); alert(opt.$trigge.attr("id")); }},
COM: {name: "Commentaire", type: "textarea", callback: function(key, opt){ console.log("key : " + key); console.log(opt); alert(opt.$trigge.attr("id")); }}
};
I'm using EF to retrieve the data as this :
var list = (from e in l_entities.TAG
where e.tag_site_code.Trim() == siteCode.Trim()
select new CvrTag
{
Id = e.tag_id,
Name = e.tag_libelle,
Type = e.tag_site_code
}
).ToList();
But I retrieve a classic Array when I use JsonConvert.SerializeObject(list).
So my question is : - How to have braces instead array's brackets - How to have an id (ie: RCP or COL) before the json object without quotes - Same to inside json object (ie: name or type)
Thanks for your help