Improve display of JSON-encoding errors

Should make debugging simpler