cast badge to int before encode payload to json