Edit

Share via


JsonReaderWriterFactory.CreateJsonWriter Method

Definition

Creates an XmlDictionaryWriter that writes data encoded with JSON to a stream.

Overloads

CreateJsonWriter(Stream)

Creates an XmlDictionaryWriter that writes data encoded with JSON to a stream.

CreateJsonWriter(Stream, Encoding)

Creates an XmlDictionaryWriter that writes data encoded with JSON to a stream with a specified character encoding.

CreateJsonWriter(Stream, Encoding, Boolean)

Creates an XmlDictionaryWriter that writes data encoded with JSON to a stream with a specified character encoding.

CreateJsonWriter(Stream, Encoding, Boolean, Boolean)

Creates an XmlDictionaryWriter that writes data encoded with JSON to a stream with a specified character.

CreateJsonWriter(Stream, Encoding, Boolean, Boolean, String)

Creates an XmlDictionaryWriter that writes data encoded with JSON to a stream with a specified character.

Remarks

The CreateJsonWriter static method returns an instance of an XmlDictionaryWriter that can map an XML Infoset to a JSON stream. The XmlDictionaryWriter is not guaranteed to produce valid JSON. If it is used in a way not supported by the JSON-XML mapping, it may either throw an exception or write an invalid JSON document.

CreateJsonWriter(Stream)

Source:
JsonReaderWriterFactory.cs
Source:
JsonReaderWriterFactory.cs
Source:
JsonReaderWriterFactory.cs

Creates an XmlDictionaryWriter that writes data encoded with JSON to a stream.

public:
 static System::Xml::XmlDictionaryWriter ^ CreateJsonWriter(System::IO::Stream ^ stream);
public static System.Xml.XmlDictionaryWriter CreateJsonWriter (System.IO.Stream stream);
static member CreateJsonWriter : System.IO.Stream -> System.Xml.XmlDictionaryWriter
Public Shared Function CreateJsonWriter (stream As Stream) As XmlDictionaryWriter

Parameters

stream
Stream

The output Stream for the JSON writer.

Returns

An XmlDictionaryWriter that writes data encoded with JSON to the stream based on an XML Infoset.

Remarks

The default character encoding is UTF-8. When the writer is closed, the stream is closed as well.

Applies to

CreateJsonWriter(Stream, Encoding)

Source:
JsonReaderWriterFactory.cs
Source:
JsonReaderWriterFactory.cs
Source:
JsonReaderWriterFactory.cs

Creates an XmlDictionaryWriter that writes data encoded with JSON to a stream with a specified character encoding.

public:
 static System::Xml::XmlDictionaryWriter ^ CreateJsonWriter(System::IO::Stream ^ stream, System::Text::Encoding ^ encoding);
public static System.Xml.XmlDictionaryWriter CreateJsonWriter (System.IO.Stream stream, System.Text.Encoding encoding);
static member CreateJsonWriter : System.IO.Stream * System.Text.Encoding -> System.Xml.XmlDictionaryWriter
Public Shared Function CreateJsonWriter (stream As Stream, encoding As Encoding) As XmlDictionaryWriter

Parameters

stream
Stream

The output Stream for the JSON writer.

encoding
Encoding

The Encoding that specifies the character encoding used by the writer. The default encoding is UTF-8.

Returns

An XmlDictionaryWriter that writes data encoded with JSON to the stream based on an XML Infoset.

Remarks

When the writer is closed, the stream is closed as well.

Applies to

CreateJsonWriter(Stream, Encoding, Boolean)

Source:
JsonReaderWriterFactory.cs
Source:
JsonReaderWriterFactory.cs
Source:
JsonReaderWriterFactory.cs

Creates an XmlDictionaryWriter that writes data encoded with JSON to a stream with a specified character encoding.

public:
 static System::Xml::XmlDictionaryWriter ^ CreateJsonWriter(System::IO::Stream ^ stream, System::Text::Encoding ^ encoding, bool ownsStream);
public static System.Xml.XmlDictionaryWriter CreateJsonWriter (System.IO.Stream stream, System.Text.Encoding encoding, bool ownsStream);
static member CreateJsonWriter : System.IO.Stream * System.Text.Encoding * bool -> System.Xml.XmlDictionaryWriter
Public Shared Function CreateJsonWriter (stream As Stream, encoding As Encoding, ownsStream As Boolean) As XmlDictionaryWriter

Parameters

stream
Stream

The output Stream for the JSON writer.

encoding
Encoding

The Encoding that specifies the character encoding used by the writer. The default encoding is UTF-8.

ownsStream
Boolean

If true, the output stream is closed by the writer when done; otherwise false. The default value is true.

Returns

An XmlDictionaryWriter that writes data encoded with JSON to the stream based on an XML Infoset.

Applies to

CreateJsonWriter(Stream, Encoding, Boolean, Boolean)

Source:
JsonReaderWriterFactory.cs
Source:
JsonReaderWriterFactory.cs
Source:
JsonReaderWriterFactory.cs

Creates an XmlDictionaryWriter that writes data encoded with JSON to a stream with a specified character.

public:
 static System::Xml::XmlDictionaryWriter ^ CreateJsonWriter(System::IO::Stream ^ stream, System::Text::Encoding ^ encoding, bool ownsStream, bool indent);
public static System.Xml.XmlDictionaryWriter CreateJsonWriter (System.IO.Stream stream, System.Text.Encoding encoding, bool ownsStream, bool indent);
static member CreateJsonWriter : System.IO.Stream * System.Text.Encoding * bool * bool -> System.Xml.XmlDictionaryWriter
Public Shared Function CreateJsonWriter (stream As Stream, encoding As Encoding, ownsStream As Boolean, indent As Boolean) As XmlDictionaryWriter

Parameters

stream
Stream

The output Stream for the JSON writer.

encoding
Encoding

The Encoding that specifies the character encoding used by the writer. The default encoding is UTF-8.

ownsStream
Boolean

If true, the output stream is closed by the writer when done; otherwise false. The default value is true.

indent
Boolean

If true, the output uses multiline format, indenting each level properly; otherwise, false.

Returns

An XmlDictionaryWriter that writes data encoded with JSON to the stream based on an XML Infoset.

Applies to

CreateJsonWriter(Stream, Encoding, Boolean, Boolean, String)

Source:
JsonReaderWriterFactory.cs
Source:
JsonReaderWriterFactory.cs
Source:
JsonReaderWriterFactory.cs

Creates an XmlDictionaryWriter that writes data encoded with JSON to a stream with a specified character.

public:
 static System::Xml::XmlDictionaryWriter ^ CreateJsonWriter(System::IO::Stream ^ stream, System::Text::Encoding ^ encoding, bool ownsStream, bool indent, System::String ^ indentChars);
public static System.Xml.XmlDictionaryWriter CreateJsonWriter (System.IO.Stream stream, System.Text.Encoding encoding, bool ownsStream, bool indent, string? indentChars);
public static System.Xml.XmlDictionaryWriter CreateJsonWriter (System.IO.Stream stream, System.Text.Encoding encoding, bool ownsStream, bool indent, string indentChars);
static member CreateJsonWriter : System.IO.Stream * System.Text.Encoding * bool * bool * string -> System.Xml.XmlDictionaryWriter
Public Shared Function CreateJsonWriter (stream As Stream, encoding As Encoding, ownsStream As Boolean, indent As Boolean, indentChars As String) As XmlDictionaryWriter

Parameters

stream
Stream

The output Stream for the JSON writer.

encoding
Encoding

The Encoding that specifies the character encoding used by the writer. The default encoding is UTF-8.

ownsStream
Boolean

If true, the output stream is closed by the writer when done; otherwise false. The default value is true.

indent
Boolean

If true, the output uses multiline format, indenting each level properly; otherwise, false.

indentChars
String

The string used to indent each level.

Returns

An XmlDictionaryWriter that writes data encoded with JSON to the stream based on an XML Infoset.

Applies to