geoview-core - v2.2.0
    Preparing search index...

    Function safeStringify

    • Safely converts a JavaScript value to a JSON string, handling circular references.

      Circular objects are replaced with the string "{Circular JSON}" to prevent JSON.stringify from throwing an error. The function also supports optional pretty-printing via the space parameter.

      Parameters

      • obj: any

        The value to stringify

      • space: number = 2

        Optional number of spaces to use for indentation in the resulting JSON string (default 2)

      Returns string

      The JSON string representation of the input value, with circular references handled