You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've experienced a strange behavior of GSON when it deserialize a json string value to Enum. I have multiple Enums of the same kind in my schema. But one resists to be deserialized correctly.
Finally I found a solution. If I add @SerializedName to each value, deserialization works correct.
Thanks for reporting this. It's definitely the goal of this project to be able to serialize enums correctly no matter what the actual values are. I think this was missed when the Gson support was added. I'll look to include this in the next release.
You're welcome. It's seems not to be mentioned in the official Gson docs when they added the SerializedName annotation. But as someone mentioned at SO:
"Note: this does not work with older versions of GSON. It works with version 2.1 and greater".
I've experienced a strange behavior of GSON when it deserialize a json string value to Enum. I have multiple Enums of the same kind in my schema. But one resists to be deserialized correctly.
Finally I found a solution. If I add
@SerializedName
to each value, deserialization works correct.So far so good. My issue is, that I have to do this by hand, and can't find a way that it's done by jsonschema2pojo automatically.
The text was updated successfully, but these errors were encountered: