JSON.stringify

q6hillz·2022년 4월 17일
0

javascript

목록 보기
16/60

The JSON.stringify() method converts a JavaScript object or value to a JSON string, optionally replacing values if a replacer function is specified or optionally including only the specified properties if a replacer array is specified.

Syntax

JSON.stringify(value)
JSON.stringify(value, replacer)
JSON.stringify(value, replacer, space)

Parameters

  • value

    The value to convert to a JSON string.

  • replacer Optional

    A function that alters the behavior of the stringification process, or an array of strings or numbers naming properties of value that should be included in the output. If replacer is null or not provided, all properties of the object are included in the resulting JSON string.

  • space Optional

    A String or Number object that's used to insert white space (including indentation, line break characters, etc.) into the output JSON string for readability purposes.If this is a Number, it indicates the number of space characters to use as white space for indenting purposes; this number is capped at 10 (if it is greater, the value is just 10). Values less than 1 indicate that no space should be used.If this is a String, the string (or the first 10 characters of the string, if it's longer than that) is used as white space.If this parameter is not provided (or is null), no white space is used.

참조 : https://ko.javascript.info/json

0개의 댓글