- ivancaceAsked on November 15, 2013 at 08:33 AM
We are using webhook, but we have a problem when a there is doble quote, Can you scape this character in the json you send by webhook?
- JotForm Supportardy0689Answered on November 15, 2013 at 10:31 AM
Hello, thanks for posting your inquiry here on the forum.
There are a few ways that you can escape special characters depending on your goals.
Normally this function escapes the values in the json object:
Normal escaping for string manipulations:
Outputs "Full Name"
echo "\"Full Name\"";
However, if you are going to use a string and insert it on a database, it is important that you use this instead:
Assuming $string contains a value with "Full name" with double quotes literally.
$string = mysqli_real_escape_string($string);
These are all in PHP script. If you are using a different server script, let us know so that we can assist you on escaping characters.
If you need further assistance, please do not hesitate to ask. Thank you
- ivancaceAnswered on November 16, 2013 at 04:04 AM
We are using Java, Gson framework. And is imposible for that framework parse values with double quote.
- JotForm SupportNeilVicenteAnswered on November 16, 2013 at 08:25 AM
Try using the Java equivalent of the following PHP codes before passing the data to Gson:
return str_replace("\\'","'" ,str_replace('\\"', '"', $str));
$newData = unescapeJSON($rawData);
The goal is to simply replace \\' and \\" with ' and " , respectively.
- ivancaceAnswered on November 16, 2013 at 09:18 AM