public dynamic ProcessProperties(ConfigurationData parent, dynamic value) { if (value is string || value is ConfigurationData) { return(value); } var jObj = value as JObject; if (null != jObj) { var retVal = new ConfigurationData(parent); var dict = new Dictionary <string, object>(jObj.Count); foreach (var kvp in jObj) { dict[kvp.Key] = ProcessProperties(retVal, jObj[kvp.Key]); } retVal.AddRange(dict); return(retVal); } var jVal = value as JValue; if (null != jVal) { return(jVal.Value); } if (value is IEnumerable) { var retVal = new ConfigurationData(parent); var tmpArray = new ArrayList(); tmpArray.AddRange(value); for (int i = 0; i != tmpArray.Count; ++i) { retVal[i] = ProcessProperties(parent, tmpArray[i]); } return(retVal); } return(value); }