I have a model field ("data") which maps to a json MYSQL field as follows:
class Person {
/** @Id @Column(type="integer", name="person_id") @GeneratedValue **/
protected $id;
/** @Column(type="json") **/
protected $data;
/** @Column(type="string") **/
protected $name;
}
I am able to query and serialize Person, but the data fields are nested:
$person = $personRepository->find(11);
echo $serializer->serialize($person, 'json');
//returns {"id": 11, "name": "Daniel", "data": {"age": 57, "city": "Omaha"} }
I would like to un-nest the data field so that it serializes inline.
//returns {"id": 11, "name": "Daniel", "age": 57, "city": "Omaha"}
Is this possible?