English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
com.fasterxml.jackson.databind.node.ObjectNodeThe class can be used to map JSON content to a JSON object structure. We can useObjectNode Classget()The method searches for a specific value in the JSON file, used to access the value of the specified field in the object node.
public JsonNode get(String fieldName)
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; public class ObjectNodeTest { public static void main(String args[]) throws Exception { String jsonString = "{\"Id\":101, "name": "Raja Ramesh", "address": "Madhapur" ObjectMapper mapper = new ObjectMapper(); ObjectNode node = mapper.readValue(jsonString, ObjectNode.class); if(node.has("name")) { System.out.println("NAME: " + node.get("name")); } } }
Output Result
NAME: "Raja Ramesh"