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

Source

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

Source

new make()

Default ctor.

readJson

Source

Obj? readJson(Str? json)

Translates the given JSON to its Fantom representation. The returned Obj may be any JSON obj.

Convenience for readJsonFromStream(json?.in)

readJsonAsList

Source

Obj?[]? readJsonAsList(Str? json)

Translates the given JSON to its Fantom List representation.

Convenience for (Obj?[]?) readJson(...)

readJsonAsMap

Source

[Str:Obj?]? readJsonAsMap(Str? json)

Translates the given JSON to its Fantom Map representation.

Convenience for ([Str:Obj?]?) readJson(...)

readJsonFromStream

Source

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 is true, the given InStream is guaranteed to be closed.