APISonar


io.ebean.Database.json

> io > ebean > Database > json
io APIs ebean APIs Database APIs json APIs

Example 1
private void testJsonScalarType(Database ebeanServer) {
    UTMaster bean = new UTMaster("one1");
    bean.setDate(LocalDate.of(2019, 04, 20));

    String json = ebeanServer.json().toJson(bean);
    assertThat(json).isEqualTo("{\"name\":\"one1\",\"date\":\"2019-04-20\"}");
    UTMaster jsonMaster = ebeanServer.json().toBean(UTMaster.class, json);
    assertThat(jsonMaster.getDate()).isEqualTo(LocalDate.of(2019, 4, 20));
  }