对象的字段转驼峰

387 阅读1分钟
    String charts = StringUtils.EMPTY;
    try {
      objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
      charts = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(contractCostLineDto);
    } catch (JsonProcessingException e) {
      log.error("fail to write contractCostLineDto {} to string", contractCostLineDto);
      e.printStackTrace();
    }