Issue 597: Export database as JSON

Yes, let's do that.