我有一个JavaScript对象,我推动了值...
var myObject = []; myObject.name = "Steve" myObject.job = "Driver"
现在我想将这些值作为JSON,即
{ "name": "Steve", "job": "Driver" }
这可能吗?我尝试过JSON stringify但它返回一个空对象
var myObject = []; 应该 var myObject = {};
var myObject = [];
var myObject = {};