public TextWriterObjectJsonConsumer(TextWriterJsonConsumer parent, string indentation) { this.mParent = parent; mPreviousIndentation = indentation; }
/// <summary> /// Serializes the given object to JSON and writes the result into /// the given TextWriter. /// </summary> /// <param name="model">The object to serialize. This may be null or a primitive.</param> /// <param name="writer">The TextWriter to write the serialized JSON to.</param> /// <param name="indentation">A flag indicating whether the resulting JSON should be pretty-printed or not.</param> public static void Write(object model, TextWriter writer, bool indentation) { var consumer = new TextWriterJsonConsumer(writer, indentation); Write(model, consumer); }
/// <summary> /// Converts this generic object model to a JSON string by writing to the /// given <see cref="TextWriter"/>. /// </summary> /// <param name="textWriter">The text writer to write to.</param> /// <param name="indentation">A flag indicating, whether to pretty-print the JSON /// string using indentation or not.</param> public void Write(TextWriter textWriter, bool indentation = true) { var consumer = new TextWriterJsonConsumer(textWriter, indentation); Write(consumer); }