N
N
Nikolai Gerasimov2016-10-04 16:04:54
Java
Nikolai Gerasimov, 2016-10-04 16:04:54

Parse json into POJO with different field structure using Jackson?

There is a rest that receives such a Json

{
  "documentGuid": null,
  "cancellingBase": {
    "guid": "c81307da-2733-40fd-80bd-a0c2e985a624",
    "name": null,
    "code": "1"
  }
}

This json needs to be mapped into Pojo
like this:
public class CancellingBase{

    private String documentGuid;

    private String cancellingBaseGuid;

    private String cancellingBaseCode;
}

those. without the nested class CancellingBase.
Is it possible to smap with Jackson?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question