How do I replace single quotes with double quotes in JavaScript?

后端 未结 7 519
遥遥无期
遥遥无期 2021-02-01 02:10

The following code replaces only one single quote:

7条回答
  •  北海茫月
    2021-02-01 03:03

    var a = "[{'column1':'value0','column2':'value1','column3':'value2'}]";
    var b = a.replace(/'/g, '"');
    console.log(b);

    Edit: Removed \ as there are useless here.

提交回复
热议问题