Even some new PHP-5.5 installations lack JSON.

Ubuntu's, specifically. So include back the native-PHP JSON
library removed previously. Also fix it; \n is allowed in JSON,
so we need the /s flag on a couple regexps.