General developer forum

How to debug SyntaxError JSON.parse: unexpected character... ?

 
Picture of Ludo M
How to debug SyntaxError JSON.parse: unexpected character... ?
 

Hello,

I am developping an enrolment plugin which do some action when \core\event\user_enrolment_created $event is trigered and I have a problem :

When I enrol a user from /enrol/manual/manage.php?enrolid=1, it works but when I enrol from moodle/enrol/users.php?id=2 I have this error:

SyntaxError

JSON.parse: unexpected character at line 1 column 1 of the JSON data
Line: 24483
I understand that it is a Json error, but I don't understand where is the bug and how to see this json (I have activated the debug options in Moodle and open the dev console in Firefox), could you please give me hint about debbuging this

 
Average of ratings: -