type

JsonReader

@Js
class JsonReader : Obj

Read Haystack data in JSON format.

constructors

make

Wrap input stream.

fields

methods

readGrid

Convenience for readVal as Grid

readVal

Read a value and auto close stream

Slot Details

make

new make(InStream in, Dict? opts := null)

Wrap input stream. By default, the reader decodes JSON in the Haystack 4 (Hayson) format. Use the v3 option to decode JSON in the Haystack 3 format.

The following opts are supported:

  • v3 (Marker): read JSON encoded in the Haystack 3 format
g := JsonReader(in).readGrid

val := JsonReader(in, Etc.makeDict(["v3":Marker.val])).readVal

opts

Dict opts { private set }

readGrid

virtual override Grid readGrid()

Convenience for readVal as Grid

readVal

Obj? readVal(Bool close := true)

Read a value and auto close stream