Jackson Object Mapper to conver String to JsonNode

Following are some of the code snippet for Jackson Object Mapper
Convert String to JsonNode Object
String data;
JsonNode jsonNode = getObjectMapper().readTree(data);
Convert an Object to JSON String
String jsonString = getObjectMapper().writeValueAsString(object);
Convert InputStream to JsonNode Object
InputStream inputStream;
JsonNode jsonNode = getObjectMapper().readTree(inputStream);

Comments

Popular posts from this blog

Difference between volatile and synchronized

Converting Java Map to String

Masking Credit Card number in Java