make serialize compatible with nested arrays and their mappings