JSON.stringify() method

The Javascript handler JSON.stringify() method is used to transform a JSON object into a JSON string representation.

Syntax:

Json.stringify(value)

Parameters
value: It represents the value which have to be converted into JSON string.

Return
JSON string.

Example:

<!DOCTYPE html>
<html>
<body>
<script>  
var details = '{ "Name":"JAI", "Seat":"56", "Coach":"5A"}';  
var passenger = JSON.stringify(details);  
document.write(passenger);   
</script>  
</body>
</html>

Output:

"{ \"Name\":\"JAI\", \"Seat\":\"56\", \"Coach\":\"5A\"}"
Please Share