JsounUtils.fromJson-第一个字母为大写字母,JsonUtils不会使用大写字母映射字段

我想解析:

.Api {
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100vw;
  background: repeating-linear-gradient(
    135deg,hsl(204,76%,70%) 0px,70%) 105px,hsl(249,70%) 210px,hsl(294,70%) 315px,hsl(339,70%) 420px,hsl(24,70%) 525px,hsl(69,70%) 630px,hsl(114,70%) 735px,hsl(159,70%) 840px
  );
  color: white;
  h1 {
    font-size: 4em;
  }
  overflow-x: hidden;
  .flex-grid {
    display: grid;
    grid-template-columns: 1fr;
    img {
      max-width: 100vw;
      padding: 20px;
    }
  }
  @media (min-width: 600px) {
    .flex-grid {
      grid-template-columns: 1fr 1fr;
      img {
        max-width: 50vw;
      }
    }
  }

  @media (min-width: 1200px) {
    .flex-grid {
      grid-template-columns: 1fr 1fr 1fr;
      img {
        max-width: 33vw;
      }
    }
  }
}

,在List<Resource> resources = Arrays.asList(JsonUtils.fromJson(json,new TypeReference<Resource[]>() {})); 中,一个字段以大写字母开头: json而非WebUrl,因此此字段为NULL。

如何强制webUrl映射具有首字母大写的字段?当然,我有JsonUtils字段(带有第一个大写字母)

iCMS 回答:JsounUtils.fromJson-第一个字母为大写字母,JsonUtils不会使用大写字母映射字段

好,我需要添加@JsonProperty("WebUrl")

喜欢

@JsonProperty("WebUrl")
private String webUrl
本文链接:https://www.f2er.com/2059363.html

大家都在问