How to flatten an ExpandoObject returned via JsonResult in asp.net mvc?

Using JSON.NET you can call SerializeObject to “flatten” the expando object: dynamic expando = new ExpandoObject(); expando.name = “John Smith”; expando.age = 30; var json = JsonConvert.SerializeObject(expando); Will output: {“name”:”John Smith”,”age”:30} In the context of an ASP.NET MVC Controller, the result can be returned using the Content-method: public class JsonController : Controller { public ActionResult … Read more

How to detect if a property exists on an ExpandoObject?

According to MSDN the declaration shows it is implementing IDictionary: public sealed class ExpandoObject : IDynamicMetaObjectProvider, IDictionary<string, Object>, ICollection<KeyValuePair<string, Object>>, IEnumerable<KeyValuePair<string, Object>>, IEnumerable, INotifyPropertyChanged You can use this to see if a member is defined: var expandoObject = …; if(((IDictionary<String, object>)expandoObject).ContainsKey(“SomeMember”)) { // expandoObject.SomeMember exists. }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)