Refactor: String callback helper added

This patch adds a helper function in the string callback of the deserializer, to reduce code duplication

Targets #499.