How can I use a keyword as a property name?
I have been serializing anonymous types into json quite successfully until now..
dynamic jsObject;
jsObject = new ExpandoObject();
jsObject.dataUrl = Controller.Url.Action("loadall", "residuals", new { EditionId = EditionId, Country = Country, ModelYear = ModelYear, MakeId = ModelId, StyleId = style.Id });
jsObject.id = style.Id;
jsObject.text = style.Name;
jsObject.iconCls = "sprite-toolbar-flag-us";
jsObject.checked = false; // <---<< the problem is here
jsObject.leaf = true;
jsObject.IsCustomQuote = style.IsCu开发者_StackOverflow中文版stomQuote;
return jsObject;
Is there a workaround? I'm gonna try to serialize a dictionary into a json object if not..
You would use the "verbatim" operator @
: jsObject.@checked = false;
精彩评论