public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { writer.WriteStartObject(); var propertyDictionary = (IDictionary <string, SerializedPropertyInfo>)value; foreach (KeyValuePair <string, SerializedPropertyInfo> pair in propertyDictionary) { writer.WritePropertyName(pair.Key); SerializedPropertyInfoConverter.Write(writer, pair.Value); } writer.WriteEndObject(); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { IDictionary <string, SerializedPropertyInfo> dictionary = (existingValue as IDictionary <string, SerializedPropertyInfo> ?? new Dictionary <string, SerializedPropertyInfo>()); reader.Read(); while (reader.TokenType == JsonToken.PropertyName) { string name = (string)reader.Value; reader.Read(); SerializedPropertyInfo value = SerializedPropertyInfoConverter.Read(reader); reader.Read(); dictionary[name] = value; } return(dictionary); }