Introduction

From Symfony 4.2, it’s possible to configure name conversion rules using metadata.

Syntax

namespace App\Entity;
 
use Symfony\Component\Serializer\Annotation\SerializedName;
 
class Person
{
    /** @SerializedName("customer_name") */
    private $firstName;
 
    public function __construct(string $firstName)
    {
        $this->firstName = $firstName;
    }
 
    // ...
}