I am generating json from PHP.
The correct way is to use json_encode ()
JSON is just a subset of Javascript, so all you know about escaping strings in Javascript is JSON.
And yes, the correct answer is to use one of the library functions, there are quite a lot of them: see Completely fair and balanced comparison of php json libraries .
Source: https://habr.com/ru/post/1698958/More articles:How to delete browser cookies using javascript? - javascriptMore Firefox Tools for Checking JavaScript Syntax? - javascriptHow to send an array through an HTTP service in Adobe Flex 3 - httpRead a 64-bit whole line from a file - c ++How to configure import path in Visual Studio IronPython projects - pythonHow to find files with ^ M from linux using csh - dosIs it possible to simulate the spacing between table cells, so that the vertical and horizontal distances are different? - htmlIs there a way to do the reverse upgrade using Subversion? - svnJython и Java вложенный класс - javaVSTO: Why is OfficeRibbon.Context null? - c #All Articles