Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/lookup-by-path > IReadonlyLookupByPath > toJson

IReadonlyLookupByPath.toJson() 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.

Serializes this LookupByPath instance to a JSON-compatible representation.

Signature:

toJson<TSerialized>(serializeValue: (value: TItem) => TSerialized): ILookupByPathJson<TSerialized>;

Parameters

Parameter

Type

Description

serializeValue

(value: TItem) => TSerialized

A function that converts a value of type TItem to a JSON-serializable form.

Returns:

ILookupByPathJson<TSerialized>

A JSON-serializable representation of this trie.

Remarks

Values that are reference-equal will be serialized once and referenced by index, ensuring that reference equality is preserved when deserialized via LookupByPath.fromJson().