public void SerializeImpl(object value) { //if ((value is IEnumerable && !value.IsExpando()) || value.IsImmutable()) if (!value.IsExtendableType()) { valueToJSON(value); } else { sb.Append("{"); bool first = true; foreach (KeyValuePair <string, object> kvp in CQ.Enumerate <KeyValuePair <string, object> >(value, new Type[] { typeof(ScriptIgnoreAttribute) })) { if (first) { first = false; } else { sb.Append(","); } sb.Append("\"" + kvp.Key + "\":"); SerializeImpl(kvp.Value); } sb.Append("}"); } }