Loading…

What is the purpose of JSON.stringify()?

This method is used to converts JavaScript objects into strings. When sending data to a web server the data should be like string.

Example

                                        

// Stringify a JavaScript object
var nObj = { "fname":"best", "mname":"interview", "lname":"question"};
var myJSONData = JSON.stringify(nObj);
document.getElementById("MyID").innerHTML = myJSONData ;

Suggest An Answer

No suggestions avaliable!

Latest post from Front end Developer Interview Questions

Ask Question