I am trying to deserialize an associative array into array of objects with a string-key.
{
"en": {
"name": "Name of product"
},
"ar": {
"name": "Name of product in arabic"
}
}
I have a class Catalog, where product translations stored in array with a locale as a key.
Symfony serializer returns me an error: The type of the key “ru” must be “int” (“string” given).
Symfony 7.1 is used.
The incoming payload comes from serializing Doctrine Collection with indexBy attribute.
How can I set an type of key for specific field in my class?
Thanks a lot,
Best regards,
Oleg
Oleg Romanenko is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.