To make the attributes in the JSON binding?

Know someone elegant way to make certain attributes mandatory in the JSON.

Rather, it is nesootvetstvie JSON nature. Yes izvinit my frontend!

But in practice, the config is stored in JSON and do not want to do the test in every component that uses this mechanism. A rather immediately during deserialization.

1) Jackson 2.6
 public MyClass(@JsonProperty(value = "x", required = true) Integer x, @JsonProperty(value = "value_y", required = y) Integer totalCount) {

2) Your tailored operating option: uses GSON and custom annotations.

Maybe there's something that makes it more elegant and out of the box?
Link or even a name will help.
July 2nd 19 at 18:14
1 answer
July 2nd 19 at 18:16
You can try JSON validation with schema.

Find more questions by tags JSONJava