Class JTokenWriter
- Namespace
- Newtonsoft.Json.Linq
- Assembly
- Newtonsoft.Json.dll
Represents a writer that provides a fast, non-cached, forward-only way of generating Json data.
public class JTokenWriter : JsonWriter, IDisposable
- Inheritance
-
JTokenWriter
- Implements
- Inherited Members
Constructors
JTokenWriter()
Initializes a new instance of the JTokenWriter class.
public JTokenWriter()
JTokenWriter(JContainer)
Initializes a new instance of the JTokenWriter class writing to the given JContainer.
public JTokenWriter(JContainer container)
Parameters
container
JContainerThe container being written to.
Properties
Token
Gets the token being writen.
public JToken Token { get; }
Property Value
- JToken
The token being writen.
Methods
Close()
Closes this stream and the underlying stream.
public override void Close()
Flush()
Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream.
public override void Flush()
WriteComment(string)
Writes out a comment
/.../
containing the specified text.
public override void WriteComment(string text)
Parameters
text
stringText to place inside the comment.
WriteEnd(JsonToken)
Writes the end.
protected override void WriteEnd(JsonToken token)
Parameters
token
JsonTokenThe token.
WriteNull()
Writes a null value.
public override void WriteNull()
WritePropertyName(string)
Writes the property name of a name/value pair on a Json object.
public override void WritePropertyName(string name)
Parameters
name
stringThe name of the property.
WriteRaw(string)
Writes raw JSON.
public override void WriteRaw(string json)
Parameters
json
stringThe raw JSON to write.
WriteStartArray()
Writes the beginning of a Json array.
public override void WriteStartArray()
WriteStartConstructor(string)
Writes the start of a constructor with the given name.
public override void WriteStartConstructor(string name)
Parameters
name
stringThe name of the constructor.
WriteStartObject()
Writes the beginning of a Json object.
public override void WriteStartObject()
WriteUndefined()
Writes an undefined value.
public override void WriteUndefined()
WriteValue(bool)
Writes a bool value.
public override void WriteValue(bool value)
Parameters
WriteValue(byte)
Writes a byte value.
public override void WriteValue(byte value)
Parameters
WriteValue(byte[])
Writes a Byte[] value.
public override void WriteValue(byte[] value)
Parameters
value
byte[]The Byte[] value to write.
WriteValue(char)
Writes a char value.
public override void WriteValue(char value)
Parameters
WriteValue(DateTime)
Writes a DateTime value.
public override void WriteValue(DateTime value)
Parameters
WriteValue(DateTimeOffset)
Writes a DateTimeOffset value.
public override void WriteValue(DateTimeOffset value)
Parameters
value
DateTimeOffsetThe DateTimeOffset value to write.
WriteValue(decimal)
Writes a decimal value.
public override void WriteValue(decimal value)
Parameters
WriteValue(double)
Writes a double value.
public override void WriteValue(double value)
Parameters
WriteValue(Guid)
Writes a Guid value.
public override void WriteValue(Guid value)
Parameters
WriteValue(short)
Writes a short value.
public override void WriteValue(short value)
Parameters
WriteValue(int)
Writes a int value.
public override void WriteValue(int value)
Parameters
WriteValue(long)
Writes a long value.
public override void WriteValue(long value)
Parameters
WriteValue(sbyte)
Writes a sbyte value.
[CLSCompliant(false)]
public override void WriteValue(sbyte value)
Parameters
WriteValue(float)
Writes a float value.
public override void WriteValue(float value)
Parameters
WriteValue(string)
Writes a string value.
public override void WriteValue(string value)
Parameters
WriteValue(TimeSpan)
Writes a TimeSpan value.
public override void WriteValue(TimeSpan value)
Parameters
WriteValue(ushort)
Writes a ushort value.
[CLSCompliant(false)]
public override void WriteValue(ushort value)
Parameters
WriteValue(uint)
Writes a uint value.
[CLSCompliant(false)]
public override void WriteValue(uint value)
Parameters
WriteValue(ulong)
Writes a ulong value.
[CLSCompliant(false)]
public override void WriteValue(ulong value)
Parameters
WriteValue(Uri)
Writes a System.Uri value.
public override void WriteValue(Uri value)
Parameters
value
UriThe System.Uri value to write.