gson: Provide an @Required annotation to indicate that a field must be present
See discussion at http://groups.google.com/group/google-
gson/browse_thread/thread/6cfdcc56742357da
During deserialization, Gson should throw a JsonParseException if it finds
that a field marked with @Required is not present.
During serialization, Gson should always write out a field marked @Required
even if it is null.
Original issue reported on code.google.com by inder123
on 17 Oct 2008 at 10:31
About this issue
- Original URL
- State: open
- Created 9 years ago
- Reactions: 306
- Comments: 22 (1 by maintainers)
Please use this thumbs up button to show your support. Every time someone replies with +1 we all get a (useless) email.
Still waiting for this feature… I want my Gson deserializing to throw an exception when a JSON doesnt have a parameter which my object do have and is either marked as
@Required
or not marked as@Optional
. This is a big dealbreaker that Gson doesn’t have this feature…Seems that no one cares this library. This issue should be marked as critical.
I would love to see this feature implemented as well.
Does Gson have this feature yet ?
Original comment by
cherva...@gmail.com
on 10 Dec 2014 at 12:46Original comment by
dinisnun...@gmail.com
on 28 Aug 2014 at 9:22