Skip to content

Serialization ​

Preview version

The jsMind V2 programming API is currently a preview. The API will change in later updates. Please check this documentation anytime for the interface that is current.

Read and write a mind map through jsMind.Serializer.create(format). JsMind.serialize() is a JSON convenience on an open map.

This page is generated from the published typings dist/jsmind.d.ts with TypeDoc.

JmMindSerializerFactory ​

Class

Creates serializers for the formats the library can read and write.

Constructor ​

ts
constructor()

create ​

ts
static create(format: string): JmMindSerializer

Creates a serializer for the given format.

Returns: A serializer for that format.

Throws

  • JsMindError If the format is not supported.

Parameters

NameTypeDescription
formatstring'json' or 'freemind'.

JmMindSerializer ​

Interface

Base interface for all mind map serializers.

deserialize ​

ts
deserialize(data: unknown): JmMind

Deserializes data to a mind map.

Returns: The deserialized mind map.

Throws

  • JsMindError If deserialization fails.

Parameters

NameTypeDescription
dataunknownThe data to deserialize.

getFormatName ​

ts
getFormatName(): string

Gets the format name this serializer supports.

Returns: The format name.

Throws

  • JsMindError If format name is not implemented.

serialize ​

ts
serialize(mind: JmMind): unknown

Serializes a mind map to the specific format.

Returns: The serialized data in the specific format.

Throws

  • JsMindError If serialization fails.

Parameters

NameTypeDescription
mindJmMindThe mind map to serialize.

validate ​

ts
validate(data: unknown): boolean

Validates if the data can be deserialized by this serializer.

Returns: True if the data is valid for this format.

Throws

  • JsMindError If validation fails.

Parameters

NameTypeDescription
dataunknownThe data to validate.

This documentation was prepared with AI assistance