When sending data to a web server, the data has to be in a string format. You can achieve this by converting JSON object into a string using stringify() method.
1 2 3 | var userJSON = {'name': 'John', age: 31} var userString = JSON.stringify(user); console.log(userString); //"{"name":"John","age":31}" |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.