A concise function that serializes an array, regardless of the depth of its contents.