The resource state 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 the app namespace IRI (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.
The JSON string with internalised IRIs and empty values omitted
TypeError If base is not a hierarchical IRI
Encodes a resource state as a JSON string.
Serialises a Resource into a JSON string, recursively internalising absolute IRIs against the provided
base.Vacuous values are never surfaced: an empty array, nested Resource, or Dictionary, at any nesting depth, causes the owning field to be omitted, while an empty object appearing as an array element, or an empty array standing as a tag's value in a Dictionary, is dropped from its container. Omission cascades, so a field left empty once its own contents are omitted is omitted in turn, and a resource left with no content at all encodes as an empty document.