标准JSON中值转换双引号
提交到服务器的的json中的某个字段是json字符串
- 需要提交的json 字符串
var aa = {"id":35,"method":"call.setAdviseMedia","params":{"nid":"83605254241","medias":[{"operator":5,"streams":[{"modeIndex":1,"key":"layout_1","type":"main","attachment":{"rect":[0,0.25,0,0.5,0.5],"nid":"1307625745"}}]}]}}
- 最终格式
{"mixWindowModel":"{\"id\":35,\"method\":\"call.setAdviseMedia\",\"params\":{\"nid\":\"83605254241\",\"medias\":[{\"operator\":5,\"streams\":[{\"modeIndex\":1,\"key\":\"layout_1\",\"type\":\"main\",\"attachment\":{\"rect\":[0,0.25,0,0.5,0.5],\"nid\":\"1307625745\"}}]}]}}"}
转换方式
console.log(JSON.stringify({"mixWindowModel":json_stringify(a)}))
本文来自博客园,作者:vx_guanchaoguo0,转载请注明原文链接:https://www.cnblogs.com/guanchaoguo/p/16285501.html