stringify

Signature #1

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

function stringify(
value: any,
replacer?: (this: any, key: string, value: any) => any,
space?: string | number,
): string;

Parameters

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

Type

let value: any;

A function that transforms the results.

Type

let replacer: (this: any, key: string, value: any) => any;

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

Type

let space: string | number;

Returns

let returnType: string;

Signature #2

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

function stringify(
value: any,
replacer?: null | Array<string | number>,
space?: string | number,
): string;

Parameters

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

Type

let value: any;

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

Type

let replacer: null | Array<string | number>;

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

Type

let space: string | number;

Returns

let returnType: string;