Issue 597: Export database as JSON

This must be URL-escaped.