Skip to content

[Serializer] deserializing array of integers #33784

@pauliusrum

Description

@pauliusrum

Symfony version(s) affected: 4.3.4

Description
Hello, I am trying to deserialize an array of integers but I am getting this exception: Could not denormalize object of type int[], no supporting normalizer found. Previously I was using JMS serializer so it was possible to define type array<int> but I get the same error with symfony serializer.

How to reproduce

<?php
$serializer = new Serializer(
    [new GetSetMethodNormalizer(), new PropertyNormalizer(), new ObjectNormalizer(), new ArrayDenormalizer()],
    [new JsonEncoder()]
);
$numbers  = $serializer->deserialize('["15"]', 'int[]', 'json');

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