我已将字符串格式的数据更改为类似于[对象对象]的格式,但我想将字符串对象更改为我尝试过json.parse的json对象,但未将其更改为json对象
你能建议我哪里做错了以及如何解决这个问题
try {
var timekeep = await Orders.findAndCountAll({
where: {
cid: orders_info.cid,
},
order: [
['id', 'DESC']
],
limit: 1,
raw: true,
});
var cont1 = JSON.stringify(timekeep.rows[0]);
var obj = JSON.parse(cont1);
} catch (err) {
console.log(err)
}
console.log('org data' + timekeep)
console.log('data as string' + cont1);
// now when I am trying to print
console.log('data as json' + obj);
console.logs的输出
org data [object Object]
data as sttring{"id":4006,"mid":1,"cid":41,"wid":7138,"oid":null,"status":null,"options":null,"starttime":"2018-08-15T06:08:55.000Z","duration":null,"ordertotal":50,"counter":null,"closetime":null}
data as json [object object]
哆啦的时光机
侃侃无极
相关分类