JavaScript JSON stringify() Method
JavaScript JSON stringify() Method
The JSON.stringify() method is used to convert a JavaScript object into strings. It is necessary because when sending data on the web server, it should be in the form of a string.
Syntax:-
Its syntax is:- JSON.stringify(obj, replacer, space)
Return:-
Its return is:- A JSON string
Further Explanation:-
Parameter | Description |
---|---|
obj | Required. The value to convert to a string |
replacer | Optional. Either a function or an array is used to transform the result for each item. |
space | Optional. Either a String or a Number to indicate how many whitespaces are needed. |