server code, basic JSON communication