The template to encode
Encoding options
Configuration options for encoding operations.
Optional Readonlybase?: IRIBase IRI for IRI internalisation (must be absolute and hierarchical).
Converts absolute IRIs to internal (root-relative) form.
If omitted, IRIs are internalised against app.
Optional Readonlyindent?: boolean | numberIndentation level for pretty-printing encoded output.
true, uses default indentationfalse or a number less than or equal to 0, disables indentationIf omitted, output is not indented.
Optional Readonlyformat?: "url" | "json" | "base64"Output encoding for the serialised template:
"json" — plain JSON string (default)"url" — URL-encoded JSON (via encodeURIComponent)"base64" — URL-safe, unpadded base64-encoded JSON (base64url)The serialised template with internalised IRIs, encoded according to format
TypeError If base is not a hierarchical IRI
Encodes a template as a JSON string.
Serialises a Template into a JSON string, recursively internalising absolute IRIs against the provided
base. The output may be additionally transport-encoded as URL-encoded JSON or URL-safe base64url-encoded JSON via theformatoption.