Is there a nice way to map this JSON to a Java object?
{
"entries": {
"prefix:someId": {
"name": "prefix:someId",
"type": "ID"
}
}
}
Wouldn't the property names of the Java object have to contain the colons, as well? This is not allowed in Java, obviously.
I am using JSONPath at the moment, but would like a more elegant solution.
CodePudding user response:
You must annotate the property with @JsonProperty
setting the value
attribute:
Defines name of the logical property, i.e. JSON object field name to use for the property.
So something like
@JsonProperty("prefix:someId")
private MyClass myField;