A slight variation on Richards answer but readTree can take a string so you can simplify it to:

ObjectMapper mapper = new ObjectMapper();
JsonNode actualObj = mapper.readTree("{\"k1\":\"v1\"}");
Answer from slashnick on Stack Overflow
🌐
Medium
medium.com › @salvipriya97 › jsonnode-explained-with-examples-d0c05324f61d
JsonNode explained with examples. What is JsonNode in Java? | by Priya Salvi | Medium
July 2, 2024 - { "fullName": "Jane Doe", "email": "jane.doe@example.com", "transactionId": "abc123", "amount": 250.75 } ... import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.da...
🌐
Jenkov
jenkov.com › tutorials › java-json › jackson-jsonnode.html
Jackson JsonNode
To read JSON into a JsonNode with Jackson, you start by creating a Jackson ObjectMapper instance. On the ObjectMapper instance you call readTree() passing the JSON source as parameter. Here is an example of deserializing JSON into a JsonNode:
🌐
Baeldung
baeldung.com › home › json › jackson › working with tree model nodes in jackson
Working with Tree Model Nodes in Jackson | Baeldung
January 8, 2024 - JsonNode locatedNode = rootNode.path("name").path("last"); Alternatively, the get or with APIs can also be used instead of path. If the path isn’t known, the search will, of course, become more complex and iterative. We can see an example of iterating over all the nodes in Section 5 – Iterating Over the Nodes.
🌐
Javadoc.io
javadoc.io › doc › com.fasterxml.jackson.core › jackson-databind › latest › com › fasterxml › jackson › databind › JsonNode.html
JsonNode - jackson-databind 2.21.2 javadoc
Bookmarks · Latest version of com.fasterxml.jackson.core:jackson-databind · https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind · Current version 2.21.2 · https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind/2.21.2 · package-list path (used for javadoc generation ...
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › system.text.json.nodes.jsonnode
JsonNode Class (System.Text.Json.Nodes) | Microsoft Learn
public ref class JsonNode abstract · public abstract class JsonNode · type JsonNode = class · Public MustInherit Class JsonNode · Inheritance · Object JsonNode · Derived · System.Text.Json.Nodes.JsonArray · System.Text.Json.Nodes.JsonObject · System.Text.Json.Nodes.JsonValue ·
Find elsewhere
🌐
Mkyong
mkyong.com › home › java › jackson tree model examples
Jackson Tree Model examples - Mkyong.com
April 29, 2024 - JsonNode rootArray = mapper.readTree(new File("c:\\projects\\user2.json")); for (JsonNode root : rootArray) { // get node like the above example 1 }
🌐
TutorialsPoint
tutorialspoint.com › jackson › jackson_tree_model.htm
Jackson - Tree Model
"Yes":"No")); JsonNode marksNode = rootNode.path("marks"); Iterator<JsonNode> iterator = marksNode.elements(); System.out.print("Marks: [ "); while (iterator.hasNext()) { JsonNode marks = iterator.next(); System.out.print(marks.intValue() + " "); } System.out.println("]"); } catch (JsonParseException e) { e.printStackTrace(); } catch (JsonMappingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
🌐
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 - Let’s try it with a simple example: public List<String> getKeysInJsonUsingJsonNodeFieldNames(String json, ObjectMapper mapper) throws JsonMappingException, JsonProcessingException { List<String> keys = new ArrayList<>(); JsonNode jsonNode = mapper....
🌐
Nim
nim-lang.org › docs › json.html
std/json
parseJsonFragments(s: Stream; filename: string = ""; rawIntegers = false; rawFloats = false): JsonNode
🌐
Javadoc.io
javadoc.io › static › tools.jackson.core › jackson-databind › 3.0.0 › tools.jackson.databind › tools › jackson › databind › JsonNode.html
JsonNode (jackson-databind 3.0.0 API)
(JsonPointer ptr, JsonNode.OverwriteMode overwriteMode, boolean preferIndex) Method that can be called on Object or Array nodes, to access a Object-valued node pointed to by given JsonPointer, if such a node exists: or if not, an attempt is made to create one and return it. For example, on document ·
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › standard › serialization › system-text-json › use-dom
How to use a JSON DOM in System.Text.Json - .NET | Microsoft Learn
October 20, 2024 - To compare two JsonNode objects for equality, including their descendant elements, use the JsonNode.DeepEquals(JsonNode, JsonNode) method. The following example shows how to use the JsonDocument class for random access to data in a JSON string:
🌐
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 - To read JSON into a JsonNode with Jackson by creating an ObjectMapper instance and call the readValue() method.
🌐
DEV Community
dev.to › vparab › working-with-jsonobject-jsonnode-jsonvalue-and-jsonarray-systemtextjson-api-5b8l
Working with JsonObject, JsonNode, JsonValue and JsonArray [System.Text.Json API] - DEV Community
May 23, 2024 - The Add method on the JsonArray accepts a parameter of type JsonNode and if you recall the definition from the json.org , a Json array could consist of a JSON object or a JSON value - this blends quiet well here, that a JsonNodein System.Text.Json could be very well be substituted by JsonValue or JsonObject i.e.
🌐
Jenkov
jenkov.com › tutorials › java-json › jackson-objectmapper.html
Jackson ObjectMapper
It is possible to use the Jackson ObjectMapper to convert a Java object to a JsonNode with the JsonNode being a JSON representation of the Java object converted. You convert a Java object to a JsonNode via the Jackson ObjectMapper valueToTree() method. Here is an example of converting a Java object to a JsonNode using the ObjectMapper valueToTree() method: