How to Convert Object to String
The JSON.stringify() Method¶
The JSON.stringify() method is used to convert object to string which is needed to send data over the web server. It converts the set of variables in the object to a JSON string:
The toString() Method¶
The toString() method is also called when you need to convert the object into a string:
JSON.Stringify() and toString()¶
The toString( ) method is called without arguments and should return a string. The string you return should be based on the value of the object for which the method was called so as to be useful.