How do I retain backslashes in strings when using JSON.stringify?

后端 未结 3 2365
忘掉有多难
忘掉有多难 2021-02-20 16:15

So I got a string that has a backslash in it. \"kIurhgFBOzDW5il89\\/lB1ZQnmmY=\".

I tried adding an extra \'\\\', but JSON.stringify( \"kIurhgFBOzDW5i

3条回答
  •  [愿得一人]
    2021-02-20 16:49

    JSON.parse(JSON.stringify("kIurhgFBOzDW5il89\\/lB1ZQnmmY="))
    // "kIurhgFBOzDW5il89\/lB1ZQnmmY="
    

提交回复
热议问题