Skip to content

Unable to find data in DTO from JSON object – parsing error ZonedDateTime

I am trying to convert the JSON timestamp object into Java

enter image description here

I have researched converting a JSON string to java but unsure what I’m looking for. I can get it to work if the JSON uses an array but unfortunately it does not use this approach.

JSON Payload

  "type": "RFID-read",
  "event": {
    "id": "3892fec6-9246-4699-ba86-99ab1df369a9",
    "timestamp": "2020-11-19T15:01:11.391+0000",
    "deviceId": "FX9600FB2D21",
    "data": {
      "format": "epc",
      "id": "000000000000000000000115",
      "reads": 1,
      "rssi": -72,
      "antennaId": "1"
  "analytics": {
    "tenant": "73876942a20c12550f996b2152e5ca9e",
    "resourceId": "000000000000000000000115",
    "location": "FX9600FB2D21",
    "timestamp": "2020-11-19T15:01:11.391+0000",
    "meta": {
      "type": "inventory"

Event DTO

@Builder(toBuilder = true)
public class ZebraEventReadsDto {

private String id;
private ZonedDateTime timestamp;
@Size(min = 1, max = 100)
private String deviceId;
private String format;
ZebraDataReadsDto data;

Update DTO

@Builder(toBuilder = true)
public class ZebraLocationUpdateDto {

    private String type;
    ZebraEventReadsDto event;

    public static List<LocationUpdateDom> toDomainModel(ZebraLocationUpdateDto zebraLocationUpdateDto) {
        List<LocationUpdateDom> locationUpdateDomList = new ArrayList<>();



        return locationUpdateDomList;




To resolving the parsing error I used the following annotation above my timestamp variable.

@JSONFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
private ZonedDateTime timestamp;

I can now return 200 OK

User contributions licensed under: CC BY-SA
4 People found this is helpful