serialize object and array values regardless of storage method