Encode value before put item