write

open fun write(value: Boolean)

Write the specified Boolean to the underlying document writer as a JSON boolean.

Parameters

value

A Boolean value.

Throws

If an I/O exception occurs.

If an arbitrary value cannot be written.


open fun write(value: BigDecimal)

Write the specified BigDecimal to the underlying document writer as a JSON number.

Parameters

value

A BigDecimal value.

Throws

If an I/O exception occurs.

If an arbitrary value cannot be written.


fun write(value: BigInteger)

Write the specified BigInteger to the underlying document writer as a JSON number.

Parameters

value

A BigInteger value.

Throws

If an I/O exception occurs.

If an arbitrary value cannot be written.


fun write(value: Int)

Write the specified Int to the underlying document writer as a JSON number.

Parameters

value

A Int value.

Throws

If an I/O exception occurs.

If an arbitrary value cannot be written.


fun write(value: Long)

Write the specified Long to the underlying document writer as a JSON number.

Parameters

value

A Long value.

Throws

If an I/O exception occurs.

If an arbitrary value cannot be written.


fun write(value: Float)

Write the specified Float to the underlying document writer as a JSON number.

Parameters

value

A Float value.

Throws

If an I/O exception occurs.

If an arbitrary value cannot be written.


fun write(value: Double)

Write the specified Double to the underlying document writer as a JSON number. Use JSON 5 extensions (and an additional NaN extension).

NOTE: The number is only written to 10^-6 precision.

Parameters

value

A Double value.

Throws

If an I/O exception occurs.

If an arbitrary value cannot be written.


fun write(value: String?)

Write the specified String to the underlying document writer as a JSON string. All non-ASCII characters are encoded as Unicode escape sequences, so only ASCII characters will be written.

Parameters

value

A String (may be null).

Throws

If an I/O exception occurs.

If an arbitrary value cannot be written.


fun write(other: JSONWriter)

Write the contents of the specified JSONWriter to the underlying document as a JSON value. This is only permitted whenever an arbitrary JSON value would be permitted.

Parameters

other

Another JSONWriter.


fun write(friendly: JSONFriendly)

Write the specified JSON-friendly value to the underlying document writer.

Parameters

friendly

A JSONFriendly value.

Throws

If an I/O exception occurs.

If an arbitrary value cannot be written.