Started work on server-side sync. Added partial implementation of
function to generate JSON from a database query.