diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php index 183e17ef0fe3..0933eab677ae 100644 --- a/src/Symfony/Component/Serializer/Serializer.php +++ b/src/Symfony/Component/Serializer/Serializer.php @@ -113,6 +113,13 @@ public function normalize($data, $format = null) } return $data; } + if ($data instanceof Traversable) { + $normalized = array(); + foreach ($data as $key => $val) { + $normalized[$key] = $this->isStructuredType($val) ? $this->normalize($val, $format) : $val; + } + return $normalized; + } if (is_object($data)) { return $this->normalizeObject($data, $format); }