GPII-609: Return token(s) as JSON

That'll teach me to make commits directly through GitHub (the line 'var token = "", len = 0;' was missing from my previous attempt).

This new commit follows a suggestion from Antranig and is much simpler. The list of tokens is now returned as JSON (and with MIME type application/json).