GSON - Optional and required fields with naming policy
问题 I need a function, that reads a json file and control the structur of the json file. Required fields should be defined. For that I found a question that resolve a part of my problem Gson optional and required fields. But in this case the naming convention has not power any more. In my case I used following GsonBuilder: this.gsonUpperCamelCase = new GsonBuilder() .registerTypeAdapter(TestClass.class, new AnnotatedDeserializer<TestClass>()) .setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL