개발모음집

how to get json value in javascript 본문

client

how to get json value in javascript

void 2019. 12. 9. 10:00

sequelize rawQuery는 raws을 json 형식으로 return 한다.

ex)

db.sequelize.query(`SELECT id FROM posts ORDER BY id DESC LIMIT 1;`, { type: db.sequelize.QueryTypes.SELECT , raw:true}).then(function (rows) {
        const id = rows[0]['id'];
        
 });

 

 

for(let i = 0; i < jsonObj.length; i++)
{
    console.log(jsonObj[i]['id']);
}

출처 : https://stackoverflow.com/questions/42290571/get-json-stringify-value