Your root node doesn't have a customerSessionId, it has a HotelListResponse. Get that first.

//other methods
public void basicTreeModelRead()
{
    JsonNode innerNode = rootNode.get("HotelListResponse"); // Get the only element in the root node
    // get an element in that node
    JsonNode aField = innerNode.get("customerSessionId");

    //the customerSessionId has a String value
    String myString = aField.asText();

    System.out.println("customerSessionId is:" + myString);
}

This prints

customerSessionId is:0ABAAA7A-90C9-7491-3FF2-7E2C37496CA2
Answer from Sotirios Delimanolis on Stack Overflow
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › system.text.json.nodes.jsonnode.getvalue
JsonNode.GetValue<T> Method (System.Text.Json.Nodes) | Microsoft Learn
Public Overridable Function GetValue(Of T) () As T · T · The type of the value to obtain from the JsonValue. T · A value converted from the JsonValue instance. FormatException · The current JsonNode cannot be represented as a {TValue}. InvalidOperationException ·
🌐
Fasterxml
fasterxml.github.io › jackson-databind › javadoc › 2.7 › com › fasterxml › jackson › databind › JsonNode.html
JsonNode (jackson-databind 2.7.0 API)
Iterator that can be used to traverse all key/value pairs for object nodes; empty iterator (no contents) for other types · public abstract JsonNode findValue(String fieldName)
🌐
Jenkov
jenkov.com › tutorials › java-json › jackson-jsonnode.html
Jackson JsonNode
The JsonNode class has a method named fieldNames() which returns an Iterator that enables you to iterate all the field names of the JsonNode. You can use the field names to get the field values.
🌐
Baeldung
baeldung.com › home › json › jackson › get all the keys in a json string using jsonnode
Get all the Keys in a JSON String Using JsonNode | Baeldung
May 11, 2024 - private void getAllKeysUsingJsonNodeFields(JsonNode jsonNode, List<String> keys) { if (jsonNode.isObject()) { Iterator<Entry<String, JsonNode>> fields = jsonNode.fields(); fields.forEachRemaining(field -> { keys.add(field.getKey()); getAllKeysUsingJsonNodeFieldNames((JsonNode) field.getValue(), keys); }); } else if (jsonNode.isArray()) { ArrayNode arrayField = (ArrayNode) jsonNode; arrayField.forEach(node -> { getAllKeysUsingJsonNodeFieldNames(node, keys); }); } } First, we’ll check whether a JSON value is an object or array.
🌐
Makeseleniumeasy
makeseleniumeasy.com › 2020 › 09 › 01 › rest-assured-tutorial-44-fetch-value-from-json-object-using-jsonnode-jackson
REST Assured Tutorial 44 – Fetch Value From JSON Object Using JsonNode – Jackson – get() & path() Methods
We need to use class ObjectMapper provided by Jackson API. ObjectMapper class provides a method “readTree()” which is responsible to deserialize JSON content as tree expressed using a set of JsonNode instances. We can get the value of a node using get() and path() methods of JsonNode class.
🌐
Makeseleniumeasy
makeseleniumeasy.com › 2020 › 09 › 16 › rest-assured-tutorial-46-fetch-value-from-json-array-using-jsonnode-jackson-get-path-methods
REST Assured Tutorial 46 – Fetch Value From JSON Array Using JsonNode – Jackson – Get() & Path() Methods
We need to use class ObjectMapper provided by Jackson API. ObjectMapper class provides a method “readTree()” which is responsible to deserialize JSON content as tree expressed using a set of JsonNode instances. We can get the value of a node using get() and path() methods of JsonNode class.
🌐
Tabnine
tabnine.com › home page › code › java › com.fasterxml.jackson.databind.jsonnode
com.fasterxml.jackson.databind.JsonNode.get java code examples | Tabnine
private static int intValue(final JsonNode json, final String fieldName) { if (json != null) { final JsonNode value = json.get(fieldName); if (value != null) { return value.asInt(-1); } } return -1; }
Find elsewhere
🌐
TutorialsPoint
tutorialspoint.com › how-to-access-the-json-fields-arrays-and-nested-objects-of-jsonnode-in-java
How to access the JSON fields, arrays and nested objects of JsonNode in Java?
May 13, 2025 - We can access a field, array or nested object using the get() method of the JsonNode class. We can return a valid string representation using the asText() method and convert the value of the node to a Java int using the asInt() method of JsonNode class.
🌐
Baeldung
baeldung.com › home › json › jackson › working with tree model nodes in jackson
Working with Tree Model Nodes in Jackson | Baeldung
January 8, 2024 - This method is well covered in the Jackson – Marshall String to JsonNode article. Please refer to it for more info. A node may be converted from a Java object by calling the valueToTree(Object fromValue) method on the ObjectMapper: ... Let’s see how it works in practice. ... public class NodeBean { private int id; private String name; public NodeBean() { } public NodeBean(int id, String name) { this.id = id; this.name = name; } // standard getters and setters }
🌐
Fasterxml
fasterxml.github.io › jackson-core › javadoc › 1.9 › org › codehaus › jackson › JsonNode.html
JsonNode (Jackson JSON Processor)
Null otherwise. public JsonNode get(String fieldName) Method for accessing value of the specified field of an object node. If this node is not an object (or it does not have a value for specified field name), or if there is no field with such name, null is returned.
🌐
Fasterxml
fasterxml.github.io › jackson-databind › javadoc › 2.4 › com › fasterxml › jackson › databind › JsonNode.html
JsonNode (jackson-databind 2.4.0 API)
Iterator that can be used to traverse all key/value pairs for object nodes; empty iterator (no contents) for other types · public abstract JsonNode findValue(String fieldName)
🌐
Tabnine
tabnine.com › home page › code › java › com.fasterxml.jackson.databind.jsonnode
com.fasterxml.jackson.databind.JsonNode.findValue java code examples | Tabnine
/** * Parses the given JsonNode which is a <code>@context</code> node and find * the value of the <code>@vocab</code> node. * * @param contextJsonNode * @return <code>String</code> the Vocab's value e.g "@vocab": * "http://schema.org" otherwise empty String * @review */ public String getVocabulary(JsonNode contextJsonNode) { JsonNode jsonNode = contextJsonNode.findValue(JSONLDConstants.VOCAB); if (jsonNode == null) { JsonNode missingNode = MissingNode.getInstance(); return missingNode.asText(); } return jsonNode.asText(); }
🌐
Sourceforge
weka.sourceforge.io › doc.dev › weka › core › json › JSONNode.html
JSONNode
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait · public JSONNode() Initializes the root container. public JSONNode(java.lang.String name, java.lang.Boolean value) Initializes the primitive container. Parameters: name - the name · value - the primitive value ·
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › system.text.json.nodes.jsonnode.item
JsonNode.Item[] Property (System.Text.Json.Nodes) | Microsoft Learn
public: property System::Text::Json::Nodes::JsonNode ^ default[int] { System::Text::Json::Nodes::JsonNode ^ get(int index); void set(int index, System::Text::Json::Nodes::JsonNode ^ value); }; public System.Text.Json.Nodes.JsonNode? this[int index] { get; set; } member this.Item(int) : System.Text.Json.Nodes.JsonNode with get, set ·