JsonWriter
@Js
class JsonWriter : Obj
Write Haystack data in JSON format.
Wrap output stream
Get a value as a JSON string
Write the grid and return this
Write any haystack value
Flush the underlying output stream and return this
Close the underlying output stream
Bool close()
Close the underlying output stream
This flush()
Flush the underlying output stream and return this
new make(OutStream out, Dict? opts)
Wrap output stream. By default, the writer encodes JSON in the Haystack 4 (Hayson) format. Use the v3 option to encode JSON in the Haystack 3 format.
The following opts are supported:
v3(Marker): write JSON in the Haystack 3 format
JsonWriter(out).writeVal(Etc.makeDict(["ts": DateTime.now])).close JsonWriter(out, Etc.makeDict(["v3":Marker.val])).writeGrid(grid).close
Dict : opts
static Str valToStr(Obj? val)
Get a value as a JSON string.
virtual This writeGrid(Grid grid)
Write the grid and return this
This writeVal(Obj? val)
Write any haystack value