geoview-core
    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.

      • Optionalspace: number = 2

        Number of spaces to use for indentation in the resulting JSON string.

      Returns string

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