How to process text in js to characters( " ` ' ) have not caused errors when parsing, when it is added to the json string and goes to the server?

AVAPROAVAPRO "sdfghjmhgfds:{ "sdfghjgdf" }sdfghjgfd 'sdfghjgfd of esmit' dsfgh

this text is added to the json:
{"nickname": "Moroz","message": "inserted text","reciever":"snegurka"}

And when reading in a php text is successfully read and processed
March 19th 20 at 09:06
1 answer
March 19th 20 at 09:08
you just need to escape the quotation marks?
text = text.replace(/("|'|`)/g, '\\$1');
Hmm, stupid little, thanks for the help. - caroline.Lakin commented on March 19th 20 at 09:11

Find more questions by tags JSON