鍍金池/ 問答/Java  HTML/ json 轉(zhuǎn)為字符串,出現(xiàn)" ?

json 轉(zhuǎn)為字符串,出現(xiàn)" ?

構造一個json

let postData = {};
postData["text"] = msgContent
postData["headImage"] = that.$store.state.sendToUser.headImage
postData["nickname"] = that.$store.state.sendToUser.nickname

在用JSON.stringify轉(zhuǎn)為字符串,字符串中出現(xiàn)"

"{"text":"41","headImage":"https://images.decor01.com/shui_0019.jpg","nickname":"草根"}"
回答
編輯回答
夏木

"是"的轉(zhuǎn)義字符,你不要用[],直接用.應該就不會了

2018年1月22日 18:04
編輯回答
尛憇藌

不會有問題的。問題出在了,你是不是用{{postData}或者v-text渲染了。換成v-html

clipboard.png


也不是我說的那個問題。。。你在什么場景出現(xiàn)的?
clipboard.png

2018年3月28日 10:40