Escape ' character in cypher quesitions

When usuig Neo4j browser I can do something like this

MATCH (x.......) set x.text = '''

I use the escape character \ to write a '

But when I try to send the same query via the HTTP API I get a parsing error, saying that it does not recognize the escape sequence.

{"results":,"errors":[{"code":"Neo.ClientError.Request.InvalidFormat","message":"Unable to deserialize request: Unrecognized character escape ''' (code 39)\n at [Source: HttpInputOverHTTP@7feebe89[c=220,q=0,[0]=null,s=STREAM]; line: 1, column: 204]"}]}

Should I escape it differently when using the HTTP-API?

SInce the strings with HTTP API is parsed by JSON parser I needed to add escape characters that take care of the JSON parsers handling of escape sequences. For example if I needed a ' sequence I hade to write \' since then the JSON parser relpace \ with \ and I then get ' to sypher.
Same thing with for example \ need to be \\ etc.