Change floats to ints recursively on env encoding

Fixes #6246
What about arrays ?