Closed kuchengrab closed 4 months ago
Hello @kuchengrab,
The "Uncaught SyntaxError: JSON.parse: bad escaped character at line 1 column 280 of the JSON data," error indicates that there is an issue with the format of the JSON object which is passed to the JSON.parse()
function.
Unfortunately, it is difficult to determine the cause of the issue using the provided survey form. We would be in a better position to research the issue if you could share an example of a problematic survey.data
object. You may submit a ticket at Help Desk and share relevant data for research.
Thank you
Thanks @JaneSjs for your reply. I sent a few lines of the data on the ticket number T18141.
Ok I did some testing myself and found one problematic JSON data line:
{\"name\":\"F. \",\"email\":\"example@gmail.com\",\"Einverstaendnis1\":false,\"newsletter\":true,\"ini\":\"ExampleIni\",\"anreise\":\"nein berlin\",\"biete-schlafplatz\":false,\"kinder\":false,\"gesamtes-forum\":\"Ja\",\"unvertr\":false,\"essen-sonst\":\"wird bestimmt lecker <3\",\"anmerkungen-sonstige\":\"Wäre sehr gerne dabei <3\"}
while it should be:
{\"name\":\"F. \",\"email\":\"example@gmail.com\",\"Einverstaendnis1\":false,\"newsletter\":true,\"ini\":\"ExampleIni\",\"anreise\":\"nein berlin\",\"biete-schlafplatz\":false,\"kinder\":false,\"gesamtes-forum\":\"Ja\",\"unvertr\":false,\"essen-sonst\":\"wird bestimmt lecker <3\",\"anmerkungen-sonstige\":\"Wäre sehr gerne dabei <3\"}
When I change the database entry manually, the error is gone and the table is rendered correctly. 🥳
So the problem seems to be that "<" triggers transformation to html code but also subsequent double quotation marks "
which is of course unintended.
This is not related to the bug anymore, but I have a follow-up question (if it makes sense, I can also repost it as a new issue/suggestion): Is it possible to order the entries by timestamp (or database id)? Alphabetic order of any field doesn't make much sense in our case (to track new registrations and send them confirmation emails). Looks like I would need to add the timestamp as a field in the survey or something to achieve that?
We fixed the problem via the https://github.com/surveyjs/surveyjs-wordpress/pull/49. The fix is already available.
Hi, when trying to show the results of a survey in the Wordpress/SurveyJS backend, it only shows the title and a blank page. The browser's error log shows the following message:
Fortunately, I was able to locate the
wp_sjs_results
table, so I can see the raw JSON data. But I'd like to be able to export the entries as CSV. Any hints what the "bad escaped character" could be or how to look for it? (I have no clue what "column 280" could mean).