Interface JsonSerializeOptions

interface JsonSerializeOptions {
    comments?: boolean;
    refText?: boolean;
    replacer?: ((key: string, value: unknown, defaultReplacer: ((key: string, value: unknown) => unknown)) => unknown);
    sourceText?: boolean;
    space?: string | number;
    textRegions?: boolean;
    uriConverter?: ((uri: URI, reference: Reference<AstNode>) => string);
}

Properties

comments?: boolean

Whether to include the $comment property, which holds comments according to the CommentProvider service.

refText?: boolean

Whether to include the $refText property for references (the name used to identify the target node).

replacer?: ((key: string, value: unknown, defaultReplacer: ((key: string, value: unknown) => unknown)) => unknown)

The replacer parameter for JSON.stringify; the default replacer given as parameter should be used to apply basic replacements.

sourceText?: boolean

Whether to include the $sourceText property, which holds the full source text from which an AST node was parsed.

space?: string | number

The space parameter for JSON.stringify, controlling whether and how to pretty-print the output.

textRegions?: boolean

Whether to include the $textRegion property, which holds information to trace AST node properties to their respective source text regions.

uriConverter?: ((uri: URI, reference: Reference<AstNode>) => string)

Used to convert and serialize URIs when the target of a cross-reference is in a different document.