const classafJson::JsonReader
sys::Obj afJson::JsonReader
@
Js
(Service) - Reads Fantom objects from JSON.
Note JsonReader
does NOT convert the resultant maps and lists in to Fantom entities.
- convertHook
virtual Obj? convertHook(Obj? val)
A simple override hook to alter values after they have been read.
By default this just returns the given value.
- make
new make()
Default ctor.
- readJson
Translates the given JSON to its Fantom representation. The returned
Obj
may be any JSON obj.Convenience for
readJsonFromStream(json?.in)
- readJsonAsList
Obj?[]? readJsonAsList(Str? json)
Translates the given JSON to its Fantom List representation.
Convenience for
(Obj?[]?) readJson(...)
- readJsonAsMap
[Str:Obj?]? readJsonAsMap(Str? json)
Translates the given JSON to its Fantom Map representation.
Convenience for
([Str:Obj?]?) readJson(...)
- readJsonFromStream
Obj? readJsonFromStream(InStream? in, Bool closeStream := true)
Reads an object from the given JSON stream and returns one of the following:
null
Bool
Int
Float
Str
Str:Obj?
Obj?[]
If
closeStream
istrue
, the givenInStream
is guaranteed to be closed.