Having the server return json for every interaction and handling errors.