const mixinafJson::EntityConverter
afJson::EntityConverter
@
Js
(Service) - Converts Fantom entity instances to and from their JsonObj representations. A JsonObj is a nested map of JSON literals.
- fromEntity
abstract Obj? fromEntity(Obj? entity, Type? entityType := null, JsonTypeMeta? meta := null)
Converts the given entity instance to its
jsonObj
representation.If
entityType
is null it defaults toentity.typeof()
.If
meta
is null then a cached version forentityType
is retrieved fromJsonTypeInspectors
.- inspectors
abstract JsonTypeInspectors inspectors()
Returns the underlying
JsonTypeInspectors
.- make
static new make(JsonTypeInspectors? inspectors := null)
Creates a new
Json
instance with the given inspectors.- toEntity
abstract Obj? toEntity(Obj? jsonObj, Type entityType, JsonTypeMeta? meta := null)
Converts the given
jsonObj
to a Fantom entity instance.If
meta
isnull
then a cached version forentityType
is retrieved fromJsonTypeInspectors
.