Cast data that's to be encoded to an array.  This is a work around of a issue where under certain circumstances array collections are wrapped with {} instead of []