1

I want to be able to check if a certain field is present in my response, and in case it is not present I would like to get an exception.

is there a way to force a GSON deserialization to throw an exception when a field is not present without a custom deserialization?

Thiago Burgos
  • 947
  • 2
  • 13
  • 17
  • Have you read [this](http://stackoverflow.com/questions/3163193) and [this](https://sites.google.com/site/gson/gson-design-document)? – Bernd Linde Jun 19 '15 at 14:01

1 Answers1

0

Gson optional and required fields

I've done something like this in the past. Registering a TypeAdapter seems to be a decent solution

Community
  • 1
  • 1
Shaun
  • 3,777
  • 4
  • 25
  • 46