public void WriteProperty(string name, IJsonSerializable value) { if (value != null) { value.Serialize(this); } }
public static Dictionary <string, object> ToJson(this IJsonSerializable serializable) { var json = new Dictionary <string, object>(); serializable.Serialize(json); return(json); }
public void WriteProperty(string name, IJsonSerializable value) { if (!this.IsNullOrEmpty(value)) { this.WritePropertyName(name); value.Serialize(this); } }
protected bool IsNullOrEmpty(IJsonSerializable instance) { if (instance != null) { emptyObjectDetector.IsEmpty = true; instance.Serialize(emptyObjectDetector); return(emptyObjectDetector.IsEmpty); } return(true); }
public void WriteProperty(string name, IJsonSerializable value) { if (value != null) { value.Serialize(this); } }
protected bool IsNullOrEmpty(IJsonSerializable instance) { if (instance != null) { this.emptyObjectDetector.IsEmpty = true; instance.Serialize(this.emptyObjectDetector); return this.emptyObjectDetector.IsEmpty; } else { return true; } }
public void WriteProperty(string name, IJsonSerializable value) { if (!this.IsNullOrEmpty(value)) { this.WritePropertyName(name); value.Serialize(this); } }
public void WriteValue(IJsonSerializable value) { if (value == null) { WriteCore("null", /* quotes */ false); } else { WriteCore(value.Serialize(this.minimizeWhitespace), /* quotes */ false); } }
/// <summary> /// Write an object to JSON. /// </summary> /// <param name="writer"></param> /// <param name="value"></param> /// <param name="serializer"></param> public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { IJsonSerializable jsonSerializable = value as IJsonSerializable; jsonSerializable.Serialize(writer, serializer); }
public static void Save(this IJsonSerializable serializable, string path) { JObject obj = serializable.Serialize(); TextIO.Save(path, obj.ToString()); }
public void WriteProperty(string name, IJsonSerializable value) { value?.Serialize(this); }