JSON.stringify() is a method in JavaScript used to convert a JavaScript object into a JSON string.
Convert object to JSON string
const user = {
name: "John",
age: 25
};
let jsonData = JSON.stringify(user);
console.log(jsonData);
JSON.stringify() is a method in JavaScript used to convert a JavaScript object into a JSON string.
Convert object to JSON string
const user = {
name: "John",
age: 25
};
let jsonData = JSON.stringify(user);
console.log(jsonData);