const classafJson::Json

sys::Obj
  afJson::Json

@Js

A simple, easy to use JSON class.

converters

Source

const JsonConverters converters

The JSON converters.

fromJson

Source

Obj? fromJson(Str? json, Type? fantomType)

Converts a JSON string to the given Fantom type. If fantomType is null, then null is always returned.

make

Source

new make([Type:JsonConverter]? converters := null, [Str:Obj?]? options := null)

Creates a JSON instance.

prettyPrint

Source

Str prettyPrint(Obj? fantomObj, Obj? options := null)

Pretty prints the given JSON string or object.

toJson

Source

Str toJson(Obj? fantomObj, Obj? options := null)

Converts the given Fantom object to its JSON string representation.

options is passed to JsonWriter, so may just be true for pretty printing.

withSerializableMode

Source

This withSerializableMode(Bool on := true)

Converts this Json object to one with the given serializableMode.

Serializable Mode is where all non-transient fields are converted, regardless of any @JsonProperty facets. Data from @JsonProperty facets, however, is still honoured if defined.

syntac: fantom
json := Json().withSerializableMode