Beispiel #1
0
 /// <summary>
 /// Creates a new <see cref="JsonWriter"/> instance and write content to the
 /// provided <see cref="Stream"/> with custom settings.
 /// </summary>
 /// <param name="node">A <see cref="JsonNode"/> instance or <c>null</c>.</param>
 /// <param name="stream">Stream that data will be written to.</param>
 /// <exception cref="System.ArgumentNullException">
 /// If <paramref name="stream"/> is <c>null</c>.
 /// </exception>
 /// <exception cref="System.ArgumentException">
 /// If <paramref name="stream"/> is not writable.
 /// </exception>
 /// <seealso cref="JsonWriter"/>
 /// <seealso cref="JsonNode.Write(IJsonWriter)"/>
 public static void WriteTo(this JsonNode node, Stream stream)
 {
     WriteTo(node, stream, JsonWriterSettings.DefaultSettings);
 }
Beispiel #2
0
 /// <inheritdoc cref="JsonNode.ConvertFrom(object)"/>
 public static JsonNode ConvertFrom(object value)
 {
     return(JsonNode.ConvertFrom(value));
 }
Beispiel #3
0
 /// <summary>
 /// Writes a <see cref="JsonNode"/> instance to the provided <see cref="StringBuilder"/>
 /// with the default formatting.
 /// </summary>
 /// <param name="node">A <see cref="JsonNode"/> instance or <c>null</c>.</param>
 /// <param name="builder">String builder.</param>
 /// <exception cref="System.ArgumentNullException">
 /// If <paramref name="builder"/> is <c>null</c>.
 /// </exception>
 /// <seealso cref="JsonWriter"/>
 /// <seealso cref="JsonNode.Write(IJsonWriter)"/>
 public static void WriteTo(this JsonNode node, StringBuilder builder)
 {
     WriteTo(node, builder, JsonWriterSettings.DefaultSettings);
 }
Beispiel #4
0
 /// <inheritdoc cref="JsonNode.ReadFrom(TextReader)"/>
 public static JsonNode ReadFrom(TextReader reader)
 {
     return(JsonNode.ReadFrom(reader));
 }
Beispiel #5
0
 /// <inheritdoc cref="JsonNode.ReadFrom(Stream)"/>
 public static JsonNode ReadFrom(Stream stream)
 {
     return(JsonNode.ReadFrom(stream));
 }
Beispiel #6
0
 /// <summary>
 /// Converts the specified <see cref="JsonNode"/> into a JSON encoded string with
 /// the default formatting.
 /// </summary>
 /// <param name="node">A <see cref="JsonNode"/> instance or <c>null</c>.</param>
 /// <returns>
 /// The JSON encoded string.
 /// </returns>
 /// <seealso cref="ToJsonString(JsonNode, JsonWriterSettings)"/>
 public static string ToJsonString(this JsonNode node)
 {
     return(ToJsonString(node, JsonWriterSettings.DefaultSettings));
 }
Beispiel #7
0
 /// <summary>
 /// Creates a new <see cref="JsonWriter"/> instance and write content to the
 /// provided <see cref="StringBuilder"/> with custom settings.
 /// </summary>
 /// <param name="node">A <see cref="JsonNode"/> instance or <c>null</c>.</param>
 /// <param name="textWriter">Text writer.</param>
 /// <exception cref="System.ArgumentNullException">
 /// If <paramref name="textWriter"/> is <c>null</c>.
 /// </exception>
 /// <seealso cref="JsonWriter"/>
 /// <seealso cref="JsonNode.Write(IJsonWriter)"/>
 public static void WriteTo(this JsonNode node, TextWriter textWriter)
 {
     WriteTo(node, textWriter, JsonWriterSettings.DefaultSettings);
 }
Beispiel #8
0
 /// <inheritdoc cref="JsonNode.ReadFrom(string)"/>
 public static JsonNode ReadFrom(string json)
 {
     return(JsonNode.ReadFrom(json));
 }