Convert type 'System.Dynamic.DynamicObject to System.Collections.IEnumerable
I'm successfully using the JavaScriptSerializer in MVC3 to de-serialize a json string in to a dynamic object. What I can't figure out is how to cast it to something I can enumerate over. The foreach line of code below is my latest attemt but it errors with: "Cannot implicitly convert type 'System.Dynamic.DynamicObject' to 'System.Collections.IEnumerable'. How can I convert or cast so that I can iterate through the dictionary? public dynamic GetEntities(string entityName, string entityField) { var serializer = new JavaScriptSerializer(); serializer.RegisterConverters(new[] { new MyProject