class

HaysonWriter

@Js
class HaysonWriter : Obj

Write Haystack data in Hayson format, the JSON encoding where a typed scalar is an object naming its own kind.

constructors make

Wrap output stream

fields opts

methods close

Close the underlying output stream

flush

Flush the underlying output stream and return this

valToStr

Get a value as a Hayson string

writeGrid

Write the grid and return this

writeVal

Write any haystack value

close Bool close()

Close the underlying output stream

flush This flush()

Flush the underlying output stream and return this

make new make(OutStream out, Dict? opts := null)

Wrap output stream.

HaysonWriter(out).writeVal(Etc.makeDict(["ts": DateTime.now])).close

The legacy Haystack 3 encoding is still written via the 'v3' option, but is deprecated and will be removed in a future version.

opts Dict : opts

valToStr static Str valToStr(Obj? val)

Get a value as a Hayson string.

writeGrid virtual This writeGrid(Grid grid)

Write the grid and return this

writeVal This writeVal(Obj? val)

Write any haystack value

Haxall 4.0.7 ∙ 27-Oct-2026 09:10 EDT