public void WriteArrayProperty(string propertyName, IEnumerable items) { if (items != null) { List <object> itemList = new List <object>(); foreach (var item in items) { if (TypeUtil.IsKnownType(item.GetType())) { var writer = new DictionaryJsonWriter(); JsonSerializer.Write(item, writer); itemList.Add(writer.ToDictionary()); } else if (item is Enum) { itemList.Add(item.ToString().ToCamelCase()); } else { itemList.Add(item); } } _jsonDictionary.Add(propertyName, itemList); } else if (_writeDefaultValues) { _jsonDictionary.Add(propertyName, items); } }
public void WriteArrayProperty(string propertyName, IEnumerable items) { if (items != null) { List<object> itemList = new List<object>(); foreach (var item in items) { if (TypeUtil.IsKnownType(item.GetType())) { var writer = new DictionaryJsonWriter(); JsonSerializer.Write(item, writer); itemList.Add(writer.ToDictionary()); } else if (item is Enum) { itemList.Add(item.ToString().ToCamelCase()); } else { itemList.Add(item); } } _jsonDictionary.Add(propertyName, itemList); } else if (_writeDefaultValues) { _jsonDictionary.Add(propertyName, items); } }
private void WriteJsonProperty(string propertyName, object json) { var writer = new DictionaryJsonWriter(); JsonSerializer.Write(json, writer); _jsonDictionary.Add(propertyName, writer.ToDictionary()); }