updated server to send and receive json