jsonString

fun jsonString(prettyPrint: Boolean = false, action: JSONWriter.() -> Unit): String

Create a JSONWriter, use it as the receiver for the action, then produce and answer a String from the writer. Use the prettyPrint flag if present, defaulting to false.

Return

The textual form of the JSON object that was written by the action, in human-readable form if prettyPrint is specified and true.

Parameters

prettyPrint

Whether the string being produced should be in a human-readable form. Defaults to false.

action

A function taking a JSONWriter as the receiver, with the intent of writing a JSON object to it.