(Bug 4904) Cast to int before we use it

This ensures that it's recognized as a number by the JSON library and gets
sent over that way.