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
🌐
Baeldung
baeldung.com › home › json › jackson › jackson – marshall string to jsonnode
Jackson - Marshall String to JsonNode | Baeldung
June 28, 2023 - If you want to dig deeper and learn other cool things you can do with the Jackson 2 – head on over to the main Jackson tutorial. Very simply, to parse the JSON String we only need an ObjectMapper: @Test public void whenParsingJsonStringIntoJsonNode_thenCorrect() throws JsonParseException, IOException { String jsonString = "{\"k1\":\"v1\",\"k2\":\"v2\"}"; ObjectMapper mapper = new ObjectMapper(); JsonNode actualObj = mapper.readTree(jsonString); assertNotNull(actualObj); }
Discussions

JsonNode.toString() needs clear Javadoc
Looks like JsonNode.toString() always returns the corresponding JSON string without any whitespace. It would be helpful to state this in its Javadoc. Sometimes it's convenient to use this method directly (e.g. More on github.com
🌐 github.com
9
January 9, 2017
java - Jackson JsonNode to string with sorted keys - Stack Overflow
I'm using Jackson 2.2.3 and need to convert a JsonNode tree into a string with sorted field keys. It's completely unclear to me how to do this, especially since the opposite is so simple - JsonNode... More on stackoverflow.com
🌐 stackoverflow.com
java - Jackson read value as string - Stack Overflow
And I just want to store the value of "data" as a string into a variable/database. ... UPD: since you're using a streaming parser, this example on Jackson usage might help. ... Sign up to request clarification or add additional context in comments. ... Thanks for answering! This is from a streaming parser, so unfortunately it is not read into a jsonNode ... More on stackoverflow.com
🌐 stackoverflow.com
Get JsonNode from String but not only JsonString
But my value is not only JsonString but also String So I want to convert it correctly to specifiy type of JsonNode. More on github.com
🌐 github.com
5
March 8, 2021
🌐
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.
🌐
Attacomsian
attacomsian.com › blog › jackson-convert-json-string-to-json-node
Convert JSON string to JsonNode using Jackson
October 14, 2022 - try { // create object mapper instance ObjectMapper mapper = new ObjectMapper(); // convert JSON file to `JsonNode` JsonNode node = mapper.readTree(Paths.get("user.json").toFile()); // `JsonNode` to JSON string String json = node.toPrettyString(); ...
🌐
GitHub
gist.github.com › ucheng › 3121142
Read String to JsonNode · GitHub
Read String to JsonNode · Raw · ReadStringToJsonNode.java · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
🌐
Attacomsian
attacomsian.com › blog › jackson-pretty-print-json-node-to-string
How to pretty print JsonNode to JSON string using Jackson
October 14, 2022 - try { // JSON string String json = "{\"name\":\"John Doe\",\"email\":\"john.doe@example.com\"," + "\"roles\":[\"Member\",\"Admin\"],\"admin\":true,\"city\"" + ":\"New York City\",\"country\":\"United States\"}"; // create object mapper instance ObjectMapper mapper = new ObjectMapper(); // convert JSON string to `JsonNode` JsonNode node = mapper.readTree(json); // `JsonNode` to JSON string String prettyString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(node); // print pretty JSON string System.out.println(prettyString); } catch (Exception ex) { ex.printStackTrace(); } ... { "name" : "John Doe", "email" : "john.doe@example.com", "roles" : [ "Member", "Admin" ], "admin" : true, "city" : "New York City", "country" : "United States" } Read the guide Working with Tree Model Nodes in Jackson for more JsonNode examples.
🌐
Baeldung
baeldung.com › home › json › jackson › difference between astext() and tostring() in jsonnode
Difference Between asText() and toString() in JsonNode | Baeldung
April 7, 2025 - The toString() method is overridden from the Object and returns a String representation of the JsonNode‘s data.
Find elsewhere
🌐
GitHub
github.com › FasterXML › jackson-databind › issues › 1492
JsonNode.toString() needs clear Javadoc · Issue #1492 · FasterXML/jackson-databind
January 9, 2017 - Looks like JsonNode.toString() always returns the corresponding JSON string without any whitespace. It would be helpful to state this in its Javadoc. Sometimes it's convenient to use this method directly (e.g. in tests).
Author   2is10
🌐
Tabnine
tabnine.com › home page › code › java › com.fasterxml.jackson.databind.jsonnode
com.fasterxml.jackson.databind.JsonNode.toString java code examples | Tabnine
@Override public String toString() { StringBuilder sb = new StringBuilder(16 + (size() << 4)); sb.append('['); for (int i = 0, len = _children.size(); i < len; ++i) { if (i > 0) { sb.append(','); } sb.append(_children.get(i).toString()); } sb.append(']'); return sb.toString(); } ... @SuppressWarnings("unchecked") public static List<String> getColumns(JsonNode n, ObjectMapper mapper) throws IOException { List<String> columns = null; if (n.has("columnNames")) columns = mapper.readValue(n.get("columnNames").toString(), List.class); return columns; }
🌐
Fasterxml
fasterxml.github.io › jackson-databind › javadoc › 2.8 › com › fasterxml › jackson › databind › JsonNode.html
JsonNode (jackson-databind 2.8.0 API)
Method that will produce ... data formats) make sure to use ObjectMapper or ObjectWriter to serialize an instance, for example: String json = objectMapper.writeValueAsString(rootNode);...
🌐
Davidsimpson
davidsimpson.me › 2017 › 01 › 09 › how-to-pretty-print-jsonnode-to-a-string-in-java
How to pretty print a JsonNode to a String in Java
January 9, 2017 - Here’s a very simple way to pretty print a com.fasterxml.jackson.databind.JsonNode: public String prettyPrintJsonString(JsonNode jsonNode) { try { ObjectMapper mapper = new ObjectMapper(); Object json = mapper.readValue(jsonNode.toString(), Object.class); return mapper.writerWithDefaultP...
🌐
Fasterxml
fasterxml.github.io › jackson-databind › javadoc › 2.7 › com › fasterxml › jackson › databind › JsonNode.html
JsonNode (jackson-databind 2.7.0 API)
Method that will produce ... data formats) make sure to use ObjectMapper or ObjectWriter to serialize an instance, for example: String json = objectMapper.writeValueAsString(rootNode);...
🌐
Fasterxml
fasterxml.github.io › jackson-databind › javadoc › 2.9 › com › fasterxml › jackson › databind › JsonNode.html
JsonNode (jackson-databind 2.9.0 API)
Method that will produce ... data formats) make sure to use ObjectMapper or ObjectWriter to serialize an instance, for example: String json = objectMapper.writeValueAsString(rootNode);...
🌐
Red Hat
access.redhat.com › webassets › avalon › d › red-hat-jboss-enterprise-application-platform › 7.1.beta › javadocs › com › fasterxml › jackson › databind › JsonNode.html
JsonNode (Red Hat JBoss Enterprise Application Platform 7.1.0.Beta1 public API)
Method that will produce ... data formats) make sure to use ObjectMapper or ObjectWriter to serialize an instance, for example: String json = objectMapper.writeValueAsString(rootNode);...
🌐
GitHub
github.com › FasterXML › jackson-databind › issues › 3073
Get JsonNode from String but not only JsonString · Issue #3073 · FasterXML/jackson-databind
March 8, 2021 - I know that we can convert JsonString to JsonNode By ObjectMapper mapper = new ObjectMapper(); JsonNode actualObj = mapper.readTree(jsonString); But my value is not only JsonString but also String So I want to convert it correctly to spe...
Author   bradhuang9999
🌐
Fasterxml
fasterxml.github.io › jackson-databind › javadoc › 2.4 › com › fasterxml › jackson › databind › JsonNode.html
JsonNode (jackson-databind 2.4.0 API)
Method that can be used to check if this node represents binary data (Base64 encoded). Although this will be externally written as JSON String value, isTextual() will return false if this method returns true.
🌐
Javatpoint
javatpoint.com › parsing-string-to-jsonnode-jackson
Parsing String to JsonNode Jackson - javatpoint
In order to... ... Jackson In this section, we will cover the most important unmarshalling process by using Jackson's "2.x" version. At present, the JSON has become popular for representing data.