Home  >  Q&A  >  body text

node.js - nodejs中使用mysql如何存储json格式数据

如题,如何存储一个json数据
db.query("INSERT table SET?",[params],callback)
params 网页一个application/json 格式数据
json格式数据中有个key的值是json,就是嵌套json
存储的时候查看数据库存的是Object object

阿神阿神2743 days ago683

reply all(2)I'll reply

  • PHPz

    PHPz2017-04-17 12:05:43

    JSON.strigify see more api

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 12:05:43

    That means your object is a js object and has not been converted into a json string. You have to store the string directly into the database.

    reply
    0
  • Cancelreply