Just to help others in same scenario ...
It turns out that in addition to the <script> filtering, the JSON error was triggered by Moodle not responding (before 100 seconds) when unzipping&database-linking etc.). I'll start another post as it's a different issue