Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. public static String asJson(final Object obj) throws JsonProcessingException {
  2. ObjectMapper mapper = new ObjectMapper();
  3. mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
  4. ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter();
  5. String requestJson = ow.writeValueAsString(obj);
  6. return requestJson;
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement