I had posted the question wrongly. I am posting the question correctly here ...
I am getting a json string as a HTTP response. I know the structure of it. It is as
Sample generic deserializing interface:
public interface Deserializable { static final ObjectMapper mapper = new ObjectMapper(); @SuppressWarnings("unchecked") default T deserialize(String rawJson) throws IOException { return mapper.readValue(rawJson, (Class) this.getClass()); } }