-
-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@SerializedName within deserialization broken? #1321
Comments
I'm not sure if I understand correctly, are you saying that you want |
Correct. This seem to be the behaviour in other serializer projects, like the mentioned example https://symfony.com/doc/current/components/serializer.html Is there a other method to segregate deserialize / serialize within your tool without customization? |
Out of curiosity, wouldn't that mean that you wouldn't be able to deserialize the same json into the structure from which you created it? If you had
you'd serialize into { "whatever": "" } but you'd need to deserialize into something the variable is Right? |
@andrei-dascalu i'm not sure that this is a valid bug report, did anyone manage to reproduce such issue? |
@goetas it's not a bug report, just thinking out loud on what would happen if serialization/deserialization would be segregated by default. |
@andrei-dascalu understood.
both serialization and deseralization should wotk/produce this json: |
When I am using the annotation @SerializedName as described within the documentation, including SerializedNameAnnotationStrategy.
I expect that with serialization the property name is being converted to that what is stated within @SerializedName.
That seems to work as intended.
But when I use deserialization (json > object), @SerializedName is also being used to populate the property instead of the property name.
Compared to other serializers, like that of the Symfony component. Sort like annotations of @SerializedName is exclusively used for serialization only, not for deserialization.
Is this by design? And what would be the recommended method within FOS to deserialize towards object properties and only use @SerializedName within serialization?
The text was updated successfully, but these errors were encountered: