Skip to content

Support array denormalization/deserialization #14582

@theofidry

Description

@theofidry

Given I have dummies which is an array of Dummy entity, the following works fine:

$serializer = $this->get('serializer');
$serializedContent = serializer->serialize($dummies, 'json');

And $serializedContent is something like:

"[
    {
        // properties of dummy object
    },
    ...
    {
        // properties of dummy object
    }
]"

However the reverse won't work because the deserialize method won't take the input as an array of Dummy objects.

It's really a pain and often requires to decode the JSON beforehand and then loop on the returned array to construct our list of entities. If this feature was supported, simply extracting the string array of the json would be enough.

Moreover it seems a bit weird not to have this feature since it's available for the serialization.

ping @dunglas.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions