Home > @rushstack/lookup-by-path > LookupByPath > fromJson
LookupByPath.fromJson() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Deserializes a LookupByPath instance from a JSON representation previously created by LookupByPath.toJson().
Signature:
static fromJson<TItem extends {}, TSerialized>(json: ILookupByPathJson<TSerialized>, deserializeValue: (serialized: TSerialized) => TItem): LookupByPath<TItem>;
Parameters
Parameter | Type | Description |
|---|---|---|
json | ILookupByPathJson<TSerialized> | The JSON representation to deserialize. |
deserializeValue | (serialized: TSerialized) => TItem | A function that converts a serialized value back to its original type. |
Returns:
LookupByPath<TItem>
A new LookupByPath instance.
Remarks
Reference equality is preserved: if multiple nodes in the serialized trie pointed at the same value (i.e., the same index in the values array), the deserialized nodes will share the same object reference.