JMS Serializer: how to use camel case for properties

后端 未结 4 1672
广开言路
广开言路 2021-01-12 00:20

I\'m using FOS Rest bundle and JMS Serializer to create a REST Api. The problem is I would like to keep the property names in the JSON response camel cased instead of using

4条回答
  •  爱一瞬间的悲伤
    2021-01-12 01:08

    I found a way to do it but it's not the best way I think, there's an annotation SerializedName wich allows you to override the property serialization. The problem is that you have to do it one by one on every property with camel case, here's the documentation: YAML: http://jmsyst.com/libs/serializer/master/reference/yml_reference Annotation: http://jmsyst.com/libs/serializer/master/reference/annotations#serializedname

提交回复
热议问题