Fantom

 

class

json::Json

sys::Obj
  json::Json

Serialization to/from Javascript Object Notation (JSON).

See docLib for details.

Slots

readSource

static Obj? read(InStream in)

Read a JSON object from the given stream and return one of the follow types:

  • null
  • Bool
  • Int
  • Float
  • Str
  • Str:Obj?
  • Obj?[]

See Str.in to read from an in-memory string.

writeSource

static Void write(OutStream out, Obj? obj)

Write the given object as JSON to the given stream. The obj must be one of the follow:

  • null
  • Bool
  • Num
  • Str
  • Str:Obj?
  • Obj?[]
  • simple (written as JSON string)
  • serializable (written as JSON object)

See docLib for details.

writeToStrSource

static Str writeToStr(Obj? obj)

Convenience for write to an in-memory string.