/// <summary>Saves as Hjson to a string.</summary> public string ToString(HjsonOptions options) { if (options == null) { throw new ArgumentNullException("options"); } var sw = new StringWriter(); HjsonValue.Save(this, sw, options); return(sw.ToString()); }
/// <summary>Saves the JSON to a TextWriter.</summary> public void Save(TextWriter textWriter, Stringify format = Stringify.Plain) { if (textWriter == null) { throw new ArgumentNullException("textWriter"); } if (format == Stringify.Hjson) { HjsonValue.Save(this, textWriter); } else { new JsonWriter(format == Stringify.Formatted).Save(this, textWriter, 0); } textWriter.Flush(); }