DEV Community

kevin
kevin

Posted on • Updated on

[Solved] Symfony json rest api normalizer how use it?

Hello,

I have in my rest api complex json, so each time i have to format array for serialization output for avoid useless information.

i use groups properties of symfony serializer but i have many endpoints.

I saw normalizer is good idea to use for this case? if yes i have to use one normalizer by contoller?

Thanks

Edit:
finally for best solution is to combine normalizer with groups, and in you normalizer with context parameter you adapt you response according groups to serialize

Top comments (0)