• 00
  • :
  • 00
  • :
  • 00

JSON.stringify without quotes on properties?

https://stackoverflow.com/questions/11233498/json-stringify-without-quotes-on-properties/11233515

 

var json = '{ "name": "J\\":ohn Smith" }'
json.replace(/\\"/g,"\uFFFF"); //U+ FFFF
json = json.replace(/\"([^"]+)\":/g,"$1:").replace(/\uFFFF/g,"\\\"");
//'{ name: "J\":ohn Smith" }'

 

posted @ 2019-03-26 11:15  Garson_Zhang  阅读(309)  评论(0编辑  收藏  举报