Support JSON output from /cgi/counter

Because it might be useful.