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.
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.
new make()
Default ctor.
Translates the given JSON to its Fantom representation. The returned
Obj
may be any JSON obj.Convenience for
readJsonFromStream(json?.in)
Obj?[]? readJsonAsList(Str? json)
Translates the given JSON to its Fantom List representation.
Convenience for
(Obj?[]?) readJson(...)
[Str:Obj?]? readJsonAsMap(Str? json)
Translates the given JSON to its Fantom Map representation.
Convenience for
([Str:Obj?]?) readJson(...)
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.