javascript - 如何把json对象格式化成"[{\"id\":\"669\",\"sales_id\":\"CRM\"}]"?
问题描述:
我通过下列方法无法得到
JSON.stringify({ "crmUserId": "CRMc94fe64bd7db473086b9e7f2bea27", "userName": "Sophie Liang", "extValues": {} })
'{"crmUserId":"CRMc94fe64bd7db473086b9e7f2bea27","userName":"Sophie Liang","extValues":{}}'
JSON.stringify(JSON.stringify({ "crmUserId": "CRMc94fe64bd7db473086b9e7f2bea27", "userName": "Sophie Liang", "extValues": {} }))
'"{\\"crmUserId\\":\\"CRMc94fe64bd7db473086b9e7f2bea27\\",\\"userName\\":\\"Sophie Liang\\",\\"extValues\\":{}}"'
第 1 个答案:
const x=JSON.stringify([{"crmUserId": "CRMc94fe64bd7db473086b9e7f2bea27","userName": "Sophie Liang","extValues": {}}])
console.log(x)
输出[{"crmUserId":"CRMc94fe64bd7db473086b9e7f2bea27","userName":"Sophie Liang","extValues":{}}]
第 2 个答案:
有没有一种可能 "\""
就是 '"'
,还是你真的要字符串里有斜杠?
我的打算是通过点击 “∨” 来增加日历表。如这样:现在我通过变量 num,来替代我上面图片中的数字。但是我一替代,就出现上图那样了,num 也不是空。为什么不能按 ...