Answers for "json node in spring boot"

1

jackson create object node from string

@Testpublic 
void givenTheJsonNode_whenRetrievingDataFromId_thenCorrect()   throws JsonParseException, IOException {
  String jsonString = "{"k1":"v1","k2":"v2"}";    
  ObjectMapper mapper = new ObjectMapper();
  
  JsonNode actualObj = mapper.readTree(jsonString);  
  JsonNode jsonNode1 = actualObj.get("k1");
  
  assertThat(jsonNode1.textValue(), equalTo("v1"));
}
Posted by: Guest on July-15-2020

Code answers related to "json node in spring boot"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language