To get the values of "last" using your approach, try this fragment:

Dim result As JsonObject = jsonResponse("result").AsObject

For Each kvp In result.AsEnumerable
    c &= kvp.Value("last").ToString & ", "
Next
Answer from Viorel on learn.microsoft.com
🌐
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 - If yes, we’ll traverse the value object as well to fetch inner nodes. As a result, we’ll get all the key names present in JSON: [Name, Age, BookInterests, Book, Author, Book, Author, FoodInterests, Breakfast, Bread, Beverage, Sandwich, Beverage] In the above example, we can also use the fields() method of the JsonNode ...
Top answer
1 of 2
2

You can use elements() method and check if value key exist then add the value to list.

Smaple code

ObjectMapper mapper = new ObjectMapper();
JsonNode jsonNode = mapper.readTree(data);

List<String> values = new ArrayList<>();
jsonNode.forEach(jsonObject -> jsonObject.elements().forEachRemaining(valueNode -> {
    if(valueNode.has("value"))
        values.add(valueNode.get("value").asText());
}));
System.out.println(values);

Output:

[http://www.wikidata.org/entity/Q42442324, http://www.wikidata.org/prop/direct/P21, Kiisu Miisu, http://www.wikidata.org/entity/Q43260736, http://www.wikidata.org/prop/direct/P21, Paddles]
2 of 2
0

Here is the solution by "Josson & Jossons". I list 2 more examples with condition filtering.

https://github.com/octomix/josson

implementation 'com.octomix.josson:josson:1.3.22'

---------------------------------------------

Josson josson = Josson.fromJsonString(
    "[" +
    "  {" +
    "    \"item\": {" +
    "      \"type\": \"uri\", \"value\": \"http://www.wikidata.org/entity/Q42442324\"" +
    "    }," +
    "    \"prop\": {" +
    "      \"type\": \"uri\", \"value\": \"http://www.wikidata.org/prop/direct/P21\"" +
    "    }," +
    "    \"itemLabel\": {" +
    "      \"xml:lang\": \"en\", \"type\": \"literal\", \"value\": \"Kiisu Miisu\"" +
    "    }" +
    "  }," +
    "  {" +
    "    \"item\": {" +
    "      \"type\": \"uri\", \"value\": \"http://www.wikidata.org/entity/Q43260736\"" +
    "    }," +
    "    \"prop\": {" +
    "      \"type\": \"uri\", \"value\": \"http://www.wikidata.org/prop/direct/P21\"" +
    "    }," +
    "    \"itemLabel\": {" +
    "      \"xml:lang\": \"en\", \"type\": \"literal\", \"value\": \"Paddles\"" +
    "    }" +
    "  }" +
    "]");

JsonNode node = josson.getNode("*.value");
System.out.println("1.\n" + node.toPrettyString());

node = josson.getNode("~'^item.*'.value");
System.out.println("2.\n" + node.toPrettyString());

node = josson.getNode("*[value.type='uri']*.value");
System.out.println("3.\n" + node.toPrettyString());

Output:

1.
[ "http://www.wikidata.org/entity/Q42442324", "http://www.wikidata.org/prop/direct/P21", "Kiisu Miisu", "http://www.wikidata.org/entity/Q43260736", "http://www.wikidata.org/prop/direct/P21", "Paddles" ]
2.
[ "http://www.wikidata.org/entity/Q42442324", "Kiisu Miisu", "http://www.wikidata.org/entity/Q43260736", "Paddles" ]
3.
[ "http://www.wikidata.org/entity/Q42442324", "http://www.wikidata.org/prop/direct/P21", "http://www.wikidata.org/entity/Q43260736", "http://www.wikidata.org/prop/direct/P21" ]
🌐
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.
🌐
Tabnine
tabnine.com › home page › code › java › org.codehaus.jackson.jsonnode
org.codehaus.jackson.JsonNode.getFields java code examples | Tabnine
protected static void fromJson( String value, Set<String> fields, Map<String, ByteIterator> result) throws IOException { JsonNode json = MAPPER.readTree(value); boolean checkFields = fields != null && !fields.isEmpty(); for (Iterator<Map.Entry<String, JsonNode>> jsonFields = json.getFields(); jsonFields.hasNext(); /* increment in loop body */) { Map.Entry<String, JsonNode> jsonField = jsonFields.next(); String name = jsonField.getKey(); if (checkFields && !fields.contains(name)) { continue; } JsonNode jsonValue = jsonField.getValue(); if (jsonValue != null && !jsonValue.isNull()) { result.put(name, new StringByteIterator(jsonValue.asText())); } } }
🌐
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.
🌐
Sourceforge
weka.sourceforge.io › doc.dev › weka › core › json › JSONNode.html
JSONNode
Returns whether the node stores a primitive value or a an array/object. ... Returns wether the node is an array. ... Returns wether the node is an object. ... Returns the type of the container. ... Adds a "null" child to the object. ... Adds a key-value child to the object.
Find elsewhere
🌐
Adobe Experience League
experienceleaguecommunities.adobe.com › t5 › adobe-experience-manager › extract-keys-from-json-node › m-p › 209101
Solved: Extract keys from Json Node - Adobe Experience League Community - 209101
February 16, 2016 - I do have a com.fasterxml.jackson.databind.JsonNode · format like this : { "jcr:primaryType": "nt:unstructured", "sling:resourceType": "foundation/components/parsys", "rwdcarousel": { "jcr:primaryType": "nt:unstructured", "jcr:createdBy": "admin", "contentFinderImage": "/etc/designs/webcms-ngtv/globallibs/img/rwdCarouselModuleIcon.jpg", "rwdcarouselType": "singleCarousel", "jcr:lastModifiedBy": "admin" } } Out of this, I need to fetch keys which contains values inside { }. Like, in this case, rwdcarousel.
🌐
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 - Use the get method of JsonNode class to access the nested JSON objects. Finally, print the values to see how it works.
Top answer
1 of 2
12

If you're trying to find a key which is placed inside nested object, you may use findValue(String key) method which returns null if a value is not found by the given key:

ObjectMapper mapper = new ObjectMapper();
JsonNode rootNode= mapper.readTree(json);

String[] keys = {
    "id", "create_date", "versions_control_advanced", "name", "nofield"
};

for (String key : keys) {
    JsonNode value = rootNode.findValue(key);
    System.out.printf("Key %s exists? %s --> value=%s%n", key, value != null,
                    value == null ? null : value.asText());

}

Output:

Key id exists? true --> value=276625
Key create_date exists? true --> value=2020-06-22T16:19:07
Key versions_control_advanced exists? true --> value=false
Key name exists? true --> value=
Key nofield exists? false --> value=null
2 of 2
0

I think you are not bound to the has() method.

You can convert the json to a map and then find the node recursively

    ObjectMapper mapper = new ObjectMapper();
    Map<String, Object> map = mapper.readValue( body, Map.class );

    ArrayList<Object> container = new ArrayList<>();
    boolean value = find( map, "id", container );

    if( value )
    {
        System.out.println( container );
    }

The recursive method should visit all the nodes and return soon as node is found

private static boolean find( Map<String, Object> map, String search, ArrayList<Object> container )
    {
        int i = 0;
        for( String s : map.keySet() )
        {
            i++;
            if( s.equals( search ) )
            {
                container.add( map.get( s ) );
                return true;
            }
            if( map.get( s ) instanceof Map )
            {
                boolean found = find( (Map<String, Object>) map.get( s ), search, container );
                if( i == map.size() || found )
                {
                    return found;
                }
            }
        }
        return false;
    }

I have edited the code to get the value also. hope this helps. I strongly suggest you to do more research on yourself before looking for help from the community.

🌐
Baeldung
baeldung.com › home › json › jackson › working with tree model nodes in jackson
Working with Tree Model Nodes in Jackson | Baeldung
January 8, 2024 - Instead, we’ll use JsonNode.fields because this gives us access to both the field name and value: Key="name", Value=Object {"first": "Tatu", "last": "Saloranta"} Key="title", Value=Value "Jackson Founder" Key="company", Value=Value "FasterXML" Key="pets", Value=Array [{"type": "dog", "number": 1},{"type": "fish", "number": 50}] For each field, we add the field name to the output and then process the value as a child node by passing it to the processNode method: private void appendNodeToYaml( JsonNode node, StringBuilder yaml, int depth, boolean isArrayItem) { Iterator<Entry<String, JsonNode>
🌐
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
You can try changing directories. ... Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here. Gets the value for the current JsonValue.
🌐
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)
🌐
Stack Overflow
stackoverflow.com › questions › 51750150 › how-to-get-value-of-key-in-same-node-level-with-json-format
How to get value of key in same node level with JSON format
... You can't use . because your object is an array type and each element in that array is a json node. So you'd need to access the relevant index and then you can operate on the object. let array = [{key: '1'}, {key: '2'}]; let jsonNode = array[0]; ...
🌐
Nim
nim-lang.org › docs › json.html
std/json
To retrieve the value of "key" you can do the following: import std/json let jsonNode = parseJson("""{"key": 3.14}""") doAssert jsonNode["key"].getFloat() == 3.14 · Important: The [] operator will raise an exception when the specified field does not exist. By using the {} operator instead ...
🌐
Answer Overflow
answeroverflow.com › m › 1162019695176724541
Working with jsonnode class - C#
October 12, 2023 - { "LicenseUsageList": [ { "UserName": "doman\\username", "LicenseType": "license type", "AcquisitionTime": "2023-10-12T08:04:52.523", "SessionType": "UISERVER-FULL", "SessionId": "session id", "LicenseProperties": [ { "Key": "DbServerPid", "Value": "64" }, { "Key": "ProgramName", "Value": "program name" }, { "Key": "DbExecutionContextId", "Value": "0" }, { "Key": "Name", "Value": "app name" }, { "Key": "LoginName", "Value": "user name" }, { "Key": "LoginTime", "Value": "10/12/2023 08:04:52" }, { "Key": "HostName", "Value": "server name" }, { "Key": "HostPid", "Value": "hostPid" } ] }, ] } I'd like to access each node via the "UserName" property and find duplicate values · C#JoinWe are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.