JMSSerializerBundle
JMSSerializerBundle copied to clipboard
Modify result
I was looking for way how to modify already serialized data.
I've registered PostSerialize event listener. Unfortunately I have no access from inside of the listener to "data" and modify it (unset variables, wrap data, etc...). I guess it would be greate to have getData() and setData() methods in JMS\Serializer\JsonSerializationVisitor.
What I was trying to archieve is to wrap serialized data like:
[
'test' => [
'foo' => 'bar'
]
]
into 'parent' to get:
[
'parent' => [
'test' => [
'foo' => 'bar'
]
]
]
If you get any bether idea plese let me know.
Any idea how I can obtain required result?
I'm curious about this as well. It seems like a trivial method, but maybe it's missing for a reason?