MismatchedInputException: Cannot deserialize instance of `com.model.Floor` out of START_ARRAY token. Почему возникает, как исправить?

есть POJO:

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@ToString
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({"uid", "access", "name", "image", "imageFilename", "index", "parent", "coefficient", "geojson",
        "creationDate", "createdBy", "modifiedDate", "modifiedBy", "scaleDistance", "scalePoints", "center"})
@Entity
@Table(name = "floor")
public class Floor {

    @Id
    @JsonProperty("uid")
    private Double uid;

    @JsonProperty("access")
    private Access access;

    @JsonProperty("name")
    private String name;

    @JsonProperty("image")
    private String image;

    @JsonProperty("imageFilename")
    private String imageFilename;

    @JsonProperty("index")
    private String index;

    @JsonProperty("parent")
    @JsonPropertyDescription("UID of the venue, where floor located")
    private Double parent;

    @JsonProperty("coefficient")
    private Double coefficient;

    @JsonProperty("geojson")
    @JsonPropertyDescription("Floor polygon in GeoJSON format")
    @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, optional = false)
    private Point geojson;

    @JsonProperty("creationDate")
    private Date creationDate;

    @JsonProperty("createdBy")
    @JsonPropertyDescription("UID of the user")
    private Double createdBy;

    @JsonProperty("modifiedDate")
    private Date modifiedDate;

    @JsonProperty("modifiedBy")
    @JsonPropertyDescription("UID of the user")
    private Double modifiedBy;

    @JsonProperty("scaleDistance")
    private Double scaleDistance;

    @JsonProperty("scalePoints")
    @JsonPropertyDescription("Measurement line in GeoJSON format")
    @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, optional = false)
    private Point scalePoints;

    @JsonProperty("center")
    @JsonPropertyDescription("floor center for map rendering")
    @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, optional = false)
    private Center center;
}

получаю объект из webClient для pojo:

Mono<Floor> mono= webClient.get()
                .uri("https://leantegra.leantegra.com/api/locations/floors")
                .attributes(ServerOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId("authProvider"))
                .retrieve().bodyToMono(Floor.class);

        Floor flour = mono.block()

Вылазит ошибка:

Caused by: org.springframework.core.codec.DecodingException: JSON decoding error: Cannot deserialize instance of com.model.Floor out of START_ARRAY token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of com.model.Floor out of START_ARRAY token

О каком START_ARRAY идет речь? Как найти где ошибка?


Ответы (1 шт):

Автор решения: Леонид Дубравский

Пол дня мучился, пока не написал здесь вопрос. Потом понял проблему и переписал:

Mono<ResponseEntity<List<Floor>>> mono= webClient.get()
                .uri("https://leantegra.leantegra.com/api/locations/floors")
                .attributes(ServerOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId("authProvider"))
                .retrieve().toEntityList(Floor.class);
→ Ссылка