Skip to content

Documentation


Documentation / @blazetrails/activemodel / JSONSerializer

Class: JSONSerializer ​

Defined in: packages/activemodel/lib/serializers/json.ts:27

Extends ​

Extended by ​

Constructors ​

Constructor ​

new JSONSerializer(): JSON

Returns ​

JSON

Properties ​

includeRootInJson ​

static includeRootInJson: string | boolean = false

Defined in: packages/activemodel/lib/serializers/json.ts:28


modelName ​

static modelName: ModelName

Defined in: packages/activemodel/lib/serializers/json.ts:30

Methods ​

asJson() ​

asJson(options?): Record<string, unknown>

Defined in: packages/activemodel/lib/serializers/json.ts:37

Parameters ​

ParameterTypeDefault value
optionsSerializeOptions & { root?: string | boolean; } | nullnull

Returns ​

Record<string, unknown>


fromJson() ​

fromJson(this, json, includeRoot?): this

Defined in: packages/activemodel/lib/serializers/json.ts:58

Parameters ​

ParameterType
thisJSON & AttributesWriter
jsonstring
includeRootstring | boolean | null

Returns ​

this


readAttributeForSerialization() ​

readAttributeForSerialization(...args): unknown

Defined in: packages/activemodel/lib/serializers/json.ts:92

Parameters ​

ParameterType
...args[string]

Returns ​

unknown


serializableHash() ​

serializableHash(...args): ReturnType<typeof serializableHash>

Defined in: packages/activemodel/lib/serializers/json.ts:89

Parameters ​

ParameterType
...args[SerializeOptions | null, boolean]

Returns ​

ReturnType<typeof serializableHash>


toJSON() ​

Call Signature ​

toJSON(options): unknown

Defined in: packages/activesupport/dist/core-ext/object/json.d.ts:15

Parameters ​
ParameterType
optionsstring
Returns ​

unknown

Inherited from ​

ToJsonWithActiveSupportEncoder.toJSON

Call Signature ​

toJSON(options?): string

Defined in: packages/activesupport/dist/core-ext/object/json.d.ts:16

Parameters ​
ParameterType
options?EncodeOptions | null
Returns ​

string

Inherited from ​

ToJsonWithActiveSupportEncoder.toJSON


[included]() ​

static [included](base): void

Defined in: packages/activemodel/lib/serializers/json.ts:32

Parameters ​

ParameterType
baseobject

Returns ​

void