__jsonWriterClose (Function)

Signature: __jsonWriterClose(writer: int) -> Result<string, Error>

Description: Internal primitive of jsonEncode: closes a writer and returns its document, or the first refusal. Call jsonEncode instead.

Parameters

  • writer (int): Handle from __jsonWriterOpen

Returns: Result<string, Error>

Example

match jsonEncode(JsonArray([JsonInt(1)])) {
    Success { value } => print(value)
    Error { message } => print(message)
}
match jsonEncode (JsonArray [JsonInt 1])
    Success value => print value
    Error message => print message