• Converts a JavaScript value to a JavaScript Object Notation (JSON) string.

    Parameters

    • value: any

      A JavaScript value, usually an object or array, to be converted.

    • Optionalreplacer: (this: any, key: string, value: any) => any

      A function that transforms the results.

    • Optionalspace: string | number

      Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.

    • Optionaloptions: {
          bigint?: boolean;
          class?: false;
          function?: boolean;
          get?: boolean;
          Infinity?: boolean;
          NaN?: boolean;
          NegativeInfinity?: boolean;
          set?: boolean;
          undefined?: boolean;
      }

      The options for stringifying the provided value.

      • Optionalbigint?: boolean

        A value that indicates whether to stringify bigints (ex. 57126n).

      • Optionalclass?: false

        A value that indicates whether to stringify classes (ex. class).\

        Warning: This option is currently ignored as it is non-functional.

      • Optionalfunction?: boolean

        A value that indicates whether to stringify functions (ex. function).

      • Optionalget?: boolean

        A value that indicates whether to stringify getter functions (ex. get).

      • OptionalInfinity?: boolean

        A value that indicates whether to stringify Infinity (ex. Infinity).

      • OptionalNaN?: boolean

        A value that indicates whether to stringify NaN (ex. NaN).

      • OptionalNegativeInfinity?: boolean

        A value that indicates whether to stringify -Infinity (ex. -Infinity).

      • Optionalset?: boolean

        A value that indicates whether to stringify setter functions (ex. set).

      • Optionalundefined?: boolean

        A value that indicates whether to stringify undefined (ex. undefined).

    Returns string

    A JavaScript Object Notation B (JSONB) string that represents the value passed in.

  • Converts a JavaScript value to a JavaScript Object Notation (JSON) string.

    Parameters

    • value: any

      A JavaScript value, usually an object or array, to be converted.

    • Optionalreplacer: (string | number)[]

      An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified.

    • Optionalspace: string | number

      Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.

    • Optionaloptions: {
          bigint?: boolean;
          class?: false;
          function?: boolean;
          get?: boolean;
          Infinity?: boolean;
          NaN?: boolean;
          NegativeInfinity?: boolean;
          set?: boolean;
          undefined?: boolean;
      }

      The options for stringifying the provided value.

      • Optionalbigint?: boolean

        A value that indicates whether to stringify bigints (ex. 57126n).

      • Optionalclass?: false

        A value that indicates whether to stringify classes (ex. class).\

        Warning: This option is currently ignored as it is non-functional.

      • Optionalfunction?: boolean

        A value that indicates whether to stringify functions (ex. function).

      • Optionalget?: boolean

        A value that indicates whether to stringify getter functions (ex. get).

      • OptionalInfinity?: boolean

        A value that indicates whether to stringify Infinity (ex. Infinity).

      • OptionalNaN?: boolean

        A value that indicates whether to stringify NaN (ex. NaN).

      • OptionalNegativeInfinity?: boolean

        A value that indicates whether to stringify -Infinity (ex. -Infinity).

      • Optionalset?: boolean

        A value that indicates whether to stringify setter functions (ex. set).

      • Optionalundefined?: boolean

        A value that indicates whether to stringify undefined (ex. undefined).

    Returns string

    A JavaScript Object Notation B (JSONB) string that represents the value passed in.