Added proper JSON encoding to server.py