Documentation
    Preparing search index...

    Function parseUntrustedJson

    • Parses untrusted JSON text under §96's size and nesting bounds.

      The order is deliberate: the text length is checked before JSON.parse allocates anything, and the depth is checked before the result reaches any recursive validator. A caller that skips this and calls JSON.parse itself gets neither guarantee.

      Parameters

      • text: string

        the untrusted document text

      • label: string

        what the document is, e.g. "Scene document" — used in the message and carried as context.document

      • Optionallimits: UntrustedJsonLimits

        the caller's bounds; omitted fields take their defaults

      Returns unknown

      the parsed value, unvalidated beyond its size and shape bounds

      FourError UNTRUSTED_INPUT_REJECTED if the text is longer than maximumTextLength or nests deeper than maximumDepth; context carries limitName, limit, and the observed measurement

      FourError INVALID_APPLICATION_STATE if a supplied limit is not a positive number

      SyntaxError if the text is not JSON