📜  将 js 更改为 json - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:35.108000             🧑  作者: Mango

代码示例1
var obj = {name: "Martin", age: 30, country: "United States"};
 
// Converting JS object to JSON string
var json = JSON.stringify(obj);
 
console.log(json);
// Prints: {"name":"Martin","age":30,"country":"United States"} 
"https://www.tutorialrepublic.com/faq/how-to-convert-js-object-to-json-string.php"