I try to read Json
file with Jackson
and depends on it, make another Json
output. The problem is to read Json
file, I created a POJO
object with fields, that represent in Json
. But it could change and there are could be appear another values, that I didn't represent in POJO
. So my logic there, is will add fields, depends on read values I've been get from Json. Is there are any way to do this, or I came not right way..
public String makeOutput() {
Collection<String> key = map.get("POJO");
for (String name : key) {
requestOut = mock.reflect(CAPM.class)
.field("name", "Anna")
.field("age", 12)
// there is field 'name', that didn't represent in POJO
.field(name, "Green")
.map(gson::toJson)
.val();
}
return requestOut;
}
I'm using mockNeat
lib. for generate Json
. "map" is a MultiValuedMap<String, String>