Imagine that I have a simple object structured like the one below:
Object (SomeClass) { $someOtherData (array) [ ... ] $data (array) [ "key": "value", "key": "value", "key": "value", "key": "value" ] }
If I were to serialize this object using JMS Serializer in JSON, I would get the result with the same structure, but with $ data on the root element, for example:
{ "someOtherData": { ... }, "data": { "key": "value", "key": "value", "key": "value", "key": "value" } }
I need the contents of the $ data variable to be at the root of the serialized result, i.e.
{ "someOtherData": { ... }, "key": "value", "key": "value", "key": "value", "key": "value" }
Is it possible? If so, how?
Seer source share