IFluidSerializer Interface
To use, import via @fluidframework/shared-object-base/legacy
.
For more information about our API support guarantees, see here.
Signature
export interface IFluidSerializer
Methods
Method | Alerts | Return Type | Description |
---|---|---|---|
decode(input) | Alpha |
any |
Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form. The original The decoded handles are implicitly bound to the handle context of this serializer. |
encode(value, bind) | Alpha |
any |
Given a mostly-plain object that may have handle objects embedded within, will return a fully-plain object where any embedded IFluidHandles have been replaced with a serializable form. The original |
parse(value) | Alpha |
any | Parses the given JSON input string and returns the JavaScript object defined by it. Any Fluid handles will be realized as part of the parse |
stringify(value, bind) | Alpha |
string | Stringifies a given value. Converts any IFluidHandle to its stringified equivalent. |
Method Details
decode
Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.
The original input
object is not mutated. This method will shallowly clone all objects in the path from the root to any replaced handles. (If no handles are found, returns the original object.)
The decoded handles are implicitly bound to the handle context of this serializer.
To use, import via @fluidframework/shared-object-base/alpha
.
For more information about our API support guarantees, see here.
Signature
decode(input: any): any;
Parameters
Parameter | Type | Description |
---|---|---|
input | any |
Returns
Return type: any
encode
Given a mostly-plain object that may have handle objects embedded within, will return a fully-plain object where any embedded IFluidHandles have been replaced with a serializable form.
The original input
object is not mutated. This method will shallowly clones all objects in the path from the root to any replaced handles. (If no handles are found, returns the original object.)
To use, import via @fluidframework/shared-object-base/alpha
.
For more information about our API support guarantees, see here.
Signature
encode(value: any, bind: IFluidHandle): any;
Parameters
Parameter | Type | Description |
---|---|---|
value | any | |
bind | IFluidHandle |
Returns
Return type: any
parse
Parses the given JSON input string and returns the JavaScript object defined by it. Any Fluid handles will be realized as part of the parse
To use, import via @fluidframework/shared-object-base/alpha
.
For more information about our API support guarantees, see here.
Signature
parse(value: string): any;
Parameters
Parameter | Type | Description |
---|---|---|
value | string |
Returns
Return type: any
stringify
Stringifies a given value. Converts any IFluidHandle to its stringified equivalent.
To use, import via @fluidframework/shared-object-base/alpha
.
For more information about our API support guarantees, see here.
Signature
stringify(value: any, bind: IFluidHandle): string;
Parameters
Parameter | Type | Description |
---|---|---|
value | any | |
bind | IFluidHandle |
Returns
Return type: string