{"id":121222,"date":"2024-05-07T07:13:38","date_gmt":"2024-05-07T06:13:38","guid":{"rendered":"https:\/\/www.baeldung.com\/java-jackson-jsonnode-collection"},"modified":"2024-05-07T07:13:38","modified_gmt":"2024-05-07T06:13:38","slug":"convert-jackson-jsonnode-to-typed-collection","status":"publish","type":"post","link":"https:\/\/gamefootballmobileanimeiphone.com\/index.php\/2024\/05\/07\/convert-jackson-jsonnode-to-typed-collection\/","title":{"rendered":"Convert Jackson JsonNode to Typed Collection"},"content":{"rendered":"<p><img src=\"https:\/\/www.baeldung.com\/wp-content\/uploads\/2021\/09\/Java-7-Featured-1024x536.png\" class=\"webfeedsFeaturedVisual wp-post-image\" alt=\"start here featured\" style=\"float: left; margin-right: 5px;\" decoding=\"async\" srcset=\"https:\/\/www.baeldung.com\/wp-content\/uploads\/2021\/09\/Java-7-Featured-1024x536.png 1024w, https:\/\/www.baeldung.com\/wp-content\/uploads\/2021\/09\/Java-7-Featured-300x157.png 300w, https:\/\/www.baeldung.com\/wp-content\/uploads\/2021\/09\/Java-7-Featured-768x402.png 768w, https:\/\/www.baeldung.com\/wp-content\/uploads\/2021\/09\/Java-7-Featured-100x52.png 100w, https:\/\/www.baeldung.com\/wp-content\/uploads\/2021\/09\/Java-7-Featured.png 1200w\" sizes=\"(max-width: 580px) 100vw, 580px\" \/><\/p>\n<h2  id=\"bd-1-overview\" data-id=\"1-overview\">1. Overview<\/h2>\n<div class=\"bd-anchor\" id=\"1-overview\"><\/div>\n<p>In this tutorial,\u00a0we&#8217;ll explore different methods of converting Jackson&#8217;s raw data type\u00a0<a href=\"https:\/\/feeds.feedblitz.com\/~\/t\/0\/0\/baeldung\/~https:\/\/www.baeldung.com\/jackson-json-node-tree-model\"><em>JsonNode<\/em><\/a> into typed Java collections. While we can read JSON using\u00a0<em>JsonNode<\/em> itself, converting it to a Java collection can be beneficial. Java collections provide advantages over raw JSON data such as type safety, faster processing, and availability of more type-specific operations.<\/p>\n<h2  id=\"bd-2-code-example\" data-id=\"2-code-example\">2. Example Setup<\/h2>\n<div class=\"bd-anchor\" id=\"2-code-example\"><\/div>\n<p>In our code example,\u00a0we&#8217;ll look at different ways to convert a\u00a0<em>JsonNode<\/em>\u00a0to a\u00a0<em>List<\/em>\u00a0or\u00a0<em>Map<\/em>\u00a0of objects.\u00a0Let&#8217;s set up the building blocks of our example.<\/p>\n<h3  id=\"bd-21-dependency\" data-id=\"21-dependency\">2.1. Dependency<\/h3>\n<div class=\"bd-anchor\" id=\"21-dependency\"><\/div>\n<p>To start with, let&#8217;s add the\u00a0<a href=\"https:\/\/feeds.feedblitz.com\/~\/t\/0\/0\/baeldung\/~https:\/\/mvnrepository.com\/artifact\/com.fasterxml.jackson.core\/jackson-core\/\">Jackson Core<\/a> dependency to the <em>pom.xml<\/em> file:<\/p>\n<pre class=\"code-fence\"><code class=\"language-xml\">&lt;dependency&gt;\r\n    &lt;groupId&gt;com.fasterxml.jackson.core&lt;\/groupId&gt;\r\n    &lt;artifactId&gt;jackson-core&lt;\/artifactId&gt;\r\n    &lt;version&gt;2.17.0&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n<\/code><\/pre>\n<h3  id=\"bd-22-json-data\" data-id=\"22-json-data\">2.2. JSON Data<\/h3>\n<div class=\"bd-anchor\" id=\"22-json-data\"><\/div>\n<p>Next, let&#8217;s define a JSON for our use case:<\/p>\n<pre class=\"code-fence\"><code class=\"language-json\">{\r\n    &quot;persons&quot;: [\r\n        {\r\n            &quot;name&quot;: &quot;John&quot;,\r\n            &quot;age&quot;: 30\r\n        },\r\n        {\r\n            &quot;name&quot;: &quot;Alice&quot;,\r\n            &quot;age&quot;: 25\r\n        }\r\n    ],\r\n    &quot;idToPerson&quot; : {\r\n        &quot;1234&quot;: {\r\n            &quot;name&quot;: &quot;John&quot;,\r\n            &quot;age&quot;: 30\r\n        },\r\n        &quot;1235&quot;: {\r\n            &quot;name&quot;: &quot;Alice&quot;,\r\n            &quot;age&quot;: 25\r\n        }\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>In the above JSON, we have a JSON array <em>persons<\/em>\u00a0and a JSON object\u00a0<em>idToPerson<\/em>. We&#8217;ll\u00a0look at methods to convert them to Java collections.<\/p>\n<h3  id=\"bd-21-the-dto\" data-id=\"21-the-dto\">2.3. The DTO<\/h3>\n<div class=\"bd-anchor\" id=\"21-the-dto\"><\/div>\n<p>Let&#8217;s define a\u00a0<em>Person<\/em>\u00a0class that we can use in our example:<\/p>\n<pre class=\"code-fence\"><code class=\"language-java\">public class Person {\r\n    private String name;\r\n    private int age;\r\n    \r\n    \/\/ constructors\/getters\/setters\r\n}\r\n<\/code><\/pre>\n<h3  id=\"bd-22-converting-json-string-to-jsonnode\" data-id=\"22-converting-json-string-to-jsonnode\">2.4. Converting JSON String to <em>JsonNode<\/em><\/h3>\n<div class=\"bd-anchor\" id=\"22-converting-json-string-to-jsonnode\"><\/div>\n<p>If we want to read an object from the entire JSON,\u00a0we can use the\u00a0<a href=\"https:\/\/feeds.feedblitz.com\/~\/t\/0\/0\/baeldung\/~https:\/\/www.baeldung.com\/jackson-object-mapper-tutorial\"><em>ObjectMapper<\/em><\/a>\u00a0class of Jackson to do so:<\/p>\n<pre class=\"code-fence\"><code class=\"language-Java\">JsonNode rootNode = new ObjectMapper().readTree(jsonString);\r\nJsonNode childNode = rootNode.get(&quot;persons&quot;);\r\n<\/code><\/pre>\n<p><strong>To convert the entire JSON into a\u00a0<em>JsonNode<\/em>\u00a0object,\u00a0we use the\u00a0<em>readTree()<\/em>\u00a0method.\u00a0We then traverse the\u00a0<em>JsonNode<\/em>\u00a0object using the\u00a0<em>get()<\/em> method that returns the nested object with the specified name.<\/strong><\/p>\n<h2  id=\"bd-3-manual-conversion\" data-id=\"3-manual-conversion\">3. Manual Conversion<\/h2>\n<div class=\"bd-anchor\" id=\"3-manual-conversion\"><\/div>\n<p>Before checking library methods, let&#8217;s look at a way to convert a\u00a0<em>JsonNode<\/em>\u00a0into a collection manually.<\/p>\n<h3  id=\"bd-31-manually-converting-jsonnode-to-list\" data-id=\"31-manually-converting-jsonnode-to-list\">3.1. Manually Converting <em>JsonNode<\/em> to <em>List<\/em><\/h3>\n<div class=\"bd-anchor\" id=\"31-manually-converting-jsonnode-to-list\"><\/div>\n<p>To convert a <em>JsonNode<\/em> to a list, we can traverse it entry by entry and create a <em>List<\/em> object with it:<img class=\"code-fence-highlighter-copy-button-icon\" \/><\/p>\n<pre class=\"code-fence\"><code class=\"language-java\">List&lt;Person&gt; manualJsonNodeToList(JsonNode personsNode) {\r\n    List&lt;Person&gt; people = new ArrayList&lt;&gt;();\r\n    for (JsonNode node : personsNode) {\r\n        Person person = new Person(node.get(&quot;name&quot;).asText(), node.get(&quot;age&quot;).asInt());\r\n        people.add(person);\r\n    }\r\n    return people;\r\n}\r\n<\/code><\/pre>\n<p>Here, we use a loop to traverse all children of the input node. This is possible only if our input node is an array.<\/p>\n<p>For each node,\u00a0we create a\u00a0<em>Person<\/em> object and add it to the list. We get <em>name<\/em> and <em>age<\/em> from the node using the\u00a0<em>get(fieldName)<\/em>\u00a0method.\u00a0<strong><em>JsonNode<\/em>\u00a0provides various methods to convert the returned value into primitive Java types.\u00a0Here,\u00a0the\u00a0<em>asText()<\/em>\u00a0and\u00a0<em>asInt()<\/em>\u00a0methods convert the value to\u00a0<em>String<\/em>\u00a0and\u00a0<em>int,<\/em>\u00a0respectively.<\/strong><\/p>\n<h3  id=\"bd-32-manually-converting-jsonnode-to-list\" data-id=\"32-manually-converting-jsonnode-to-list\">3.2. Manually Converting <em>JsonNode<\/em> to <em>Map<\/em><\/h3>\n<div class=\"bd-anchor\" id=\"32-manually-converting-jsonnode-to-list\"><\/div>\n<p>Let&#8217;s look at a similar conversion for the map:<img class=\"code-fence-highlighter-copy-button-icon\" \/><\/p>\n<pre class=\"code-fence\"><code class=\"language-java\">Map&lt;String, Person&gt; manualJsonNodeToMap(JsonNode idToPersonsNode) {\r\n    Map&lt;String, Person&gt; mapOfIdToPerson = new HashMap&lt;&gt;();\r\n    idToPersonsNode.fields()\r\n      .forEachRemaining(node -&gt; mapOfIdToPerson.put(node.getKey(),\r\n        new Person(node.getValue().get(&quot;name&quot;).asText(), node.getValue().get(&quot;age&quot;).asInt())));\r\n    return mapOfIdToPerson;\r\n}\r\n<\/code><\/pre>\n<p>Here, we use the <em>fields()<\/em> method to iterate over map entries.\u00a0It returns an\u00a0<em>Iterator&lt;Map.Entry&lt;String, JsonNode&gt;&gt;<\/em> object that we can process further. Next, we read each entry and put it into our <em>Map<\/em>.<\/p>\n<h2  id=\"bd-4-using-jacksons-readvalue-and-convertvalue\" data-id=\"4-using-jacksons-readvalue-and-convertvalue\">4. Using Jackson&#8217;s <em>readValue()<\/em> and <em>convertValue()<\/em><\/h2>\n<div class=\"bd-anchor\" id=\"4-using-jacksons-readvalue-and-convertvalue\"><\/div>\n<p>Jackson provides multiple methods to convert\u00a0<em>JsonNode<\/em> into Java objects. Let&#8217;s look at two of them.<\/p>\n<h3  id=\"bd-41-using-readvalue\" data-id=\"41-using-readvalue\">4.1. Using <em>readValue()<\/em><\/h3>\n<div class=\"bd-anchor\" id=\"41-using-readvalue\"><\/div>\n<p>The\u00a0<a href=\"https:\/\/feeds.feedblitz.com\/~\/t\/0\/0\/baeldung\/~https:\/\/www.baeldung.com\/jackson-object-mapper-tutorial#Reading\"><em>readValue()<\/em>\u00a0<\/a>method can be used to convert to\u00a0<em>List<\/em>\u00a0or\u00a0<em>Map<\/em>\u00a0using a\u00a0<em>TypeReference<\/em>:<\/p>\n<pre class=\"code-fence\"><code class=\"language-java\">List&lt;Person&gt; readValueJsonNodeToList(JsonNode personsNode) throws IOException {\r\n    TypeReference&lt;List&lt;Person&gt;&gt; typeReferenceList = new TypeReference&lt;List&lt;Person&gt;&gt;() {};\r\n    return new ObjectMapper().readValue(personsNode.traverse(), typeReferenceList);\r\n}\r\nMap&lt;String, Person&gt; readValueJsonNodeToMap(JsonNode idToPersonsNode) throws IOException {\r\n    TypeReference&lt;Map&lt;String, Person&gt;&gt; typeReferenceMap = new TypeReference&lt;Map&lt;String, Person&gt;&gt;() {};\r\n    return new ObjectMapper().readValue(idToPersonsNode.traverse(), typeReferenceMap);\r\n}\r\n<\/code><\/pre>\n<p>First, we create a <em>TypeReference<\/em>\u00a0object by passing the exact type we need to convert to.\u00a0We then call the\u00a0<em>readValue()<\/em>\u00a0method where\u00a0<em>JsonParser<\/em>\u00a0is provided by\u00a0<em>jsonNode.traverse()<\/em>.\u00a0Using the parser,\u00a0it deserializes the node to a list or map as per the\u00a0<em>TypeReference<\/em> we provide.<\/p>\n<h3  id=\"bd-42-using-convertvalue\" data-id=\"42-using-convertvalue\">4.2. Using <em>convertValue()<\/em><\/h3>\n<div class=\"bd-anchor\" id=\"42-using-convertvalue\"><\/div>\n<p>Similarly,\u00a0we can use the\u00a0<em>convertValue()<\/em>\u00a0method:<img class=\"code-fence-highlighter-copy-button-icon\" \/><\/p>\n<pre class=\"code-fence\"><code class=\"language-java\">List&lt;Person&gt; convertValueJsonNodeToList(JsonNode personsNode) {\r\n    TypeReference&lt;List&lt;Person&gt;&gt; typeReferenceList = new TypeReference&lt;List&lt;Person&gt;&gt;() {};\r\n    return new ObjectMapper().convertValue(personsNode, typeReferenceList);\r\n}\r\nMap&lt;String, Person&gt; convertValueJsonNodeToMap(JsonNode idToPersonsNode) {\r\n    TypeReference&lt;Map&lt;String, Person&gt;&gt; typeReferenceMap = new TypeReference&lt;Map&lt;String, Person&gt;&gt;() {};\r\n    return new ObjectMapper().convertValue(idToPersonsNode, typeReferenceMap);\r\n}\r\n<\/code><\/pre>\n<p><strong>The\u00a0<em>convertValue()<\/em> method works by first serializing the input object and then deserializing it to the desired type.<\/strong>\u00a0Therefore,\u00a0it can be used more flexibly for converting from one object to another.\u00a0For example,\u00a0we could also use it for reverse comparison from a Java object to\u00a0<em>JsonNode<\/em>.<\/p>\n<h2  id=\"bd-5-custom-deserializer\" data-id=\"5-custom-deserializer\">5. Custom Deserializer<\/h2>\n<div class=\"bd-anchor\" id=\"5-custom-deserializer\"><\/div>\n<p>We can also provide a <a href=\"https:\/\/feeds.feedblitz.com\/~\/t\/0\/0\/baeldung\/~https:\/\/www.baeldung.com\/jackson-deserialization\">custom deserializer<\/a> to perform the conversion.\u00a0Let&#8217;s look at how we can define one:<img class=\"code-fence-highlighter-copy-button-icon\" \/><\/p>\n<pre class=\"code-fence\"><code class=\"language-java\">public class CustomPersonListDeserializer extends JsonDeserializer&lt;List&lt;Person&gt;&gt; {\r\n    @Override\r\n    public List&lt;Person&gt; deserialize(com.fasterxml.jackson.core.JsonParser p, \r\n      com.fasterxml.jackson.databind.DeserializationContext ctxt) throws IOException {\r\n        ObjectMapper objectMapper = (ObjectMapper) p.getCodec();\r\n        List&lt;Person&gt; personList = new ArrayList&lt;&gt;();\r\n        JsonNode personsNode = objectMapper.readTree(p);\r\n        for (JsonNode node : personsNode) {\r\n            personList.add(objectMapper.readValue(node.traverse(), Person.class));\r\n        }\r\n        return personList;\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>Let&#8217;s look at a few important parts of the code:<\/p>\n<ul>\n<li>First, the class extends Jackson&#8217;s <em>JsonDeserializer<\/em>.<\/li>\n<li>Then, we override the <em>deserialize()<\/em> method and provide our implementation.<\/li>\n<li>In the implementation, we get the\u00a0<em>ObjectMapper<\/em>\u00a0from the\u00a0<em>JsonParser<\/em>\u00a0object.<\/li>\n<li><em>objectMapper.readTree()<\/em>\u00a0converts the entire tree represented by the parser into a\u00a0<em>JsonNode<\/em>\u00a0instance.<\/li>\n<li>Finally, similar to the manual conversion, we convert each node in the JSON array to a <em>Person<\/em>\u00a0object by looping over the nodes.<\/li>\n<\/ul>\n<p><strong>The deserializer works similarly to other methods, except it can provide a separation of concern. Additionally, custom deserializers provide flexibility as we can easily switch between deserializers in the calling code.<\/strong><\/p>\n<p>We&#8217;ll look at how to use the deserializer when we test the code in the next section.<\/p>\n<h2  id=\"bd-6-testing\" data-id=\"6-testing\">6. Testing<\/h2>\n<div class=\"bd-anchor\" id=\"6-testing\"><\/div>\n<p>Now that we have our different methods ready, let&#8217;s write some tests to verify them.<\/p>\n<h3  id=\"bd-61-setup\" data-id=\"61-setup\">6.1. Setup<\/h3>\n<div class=\"bd-anchor\" id=\"61-setup\"><\/div>\n<p>Let&#8217;s set up our test class:<\/p>\n<pre class=\"code-fence\"><code class=\"language-java\">public class JsonNodeToCollectionUnitTest {\r\n    public static String jsonString = &quot;{\\&quot;persons\\&quot;:[{\\&quot;name\\&quot;:\\&quot;John\\&quot;,\\&quot;age\\&quot;:30},{\\&quot;name\\&quot;:\\&quot;Alice\\&quot;,\\&quot;age\\&quot;:25}],\\&quot;idToPerson\\&quot;:{\\&quot;1234\\&quot;:{\\&quot;name\\&quot;:\\&quot;John\\&quot;,\\&quot;age\\&quot;:30},\\&quot;1235\\&quot;:{\\&quot;name\\&quot;:\\&quot;Alice\\&quot;,\\&quot;age\\&quot;:25}}}&quot;;\r\n    static JsonNode completeJson;\r\n    static JsonNode personsNode;\r\n    static JsonNode idToPersonNode;\r\n    @BeforeAll\r\n    static void setup() throws JsonProcessingException {\r\n        completeJson = new ObjectMapper().readTree(jsonString);\r\n        personsNode = completeJson.get(&quot;persons&quot;);\r\n        idToPersonNode = completeJson.get(&quot;idToPerson&quot;);\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>Here, we define a JSON string that we can use as a test input. Then, we define a <em>setup()<\/em>\u00a0method that executes before all tests.\u00a0It sets up our input\u00a0<em>JsonNode<\/em>\u00a0objects.<\/p>\n<h3  id=\"bd-62-testing-conversion-methods\" data-id=\"62-testing-conversion-methods\">6.2. Testing Conversion Methods<\/h3>\n<div class=\"bd-anchor\" id=\"62-testing-conversion-methods\"><\/div>\n<p>Next,\u00a0let&#8217;s test our conversion methods:<\/p>\n<pre class=\"code-fence\"><code class=\"language-java\">@Test\r\nvoid givenJsonNode_whenConvertingToList_thenFieldsAreCorrect() throws IOException {\r\n    List&lt;Person&gt; personList1 = JsonNodeConversionUtil.manualJsonNodeToList(personsNode);\r\n    List&lt;Person&gt; personList2 = JsonNodeConversionUtil.readValueJsonNodeToList(personsNode);\r\n    List&lt;Person&gt; personList3 = JsonNodeConversionUtil.convertValueJsonNodeToList(personsNode);\r\n    validateList(personList1);\r\n    validateList(personList2);\r\n    validateList(personList3);\r\n}\r\nprivate void validateList(List&lt;Person&gt; personList) {\r\n    assertEquals(2, personList.size());\r\n    Person person1 = personList.get(0);\r\n    assertEquals(&quot;John&quot;, person1.getName());\r\n    assertEquals(30, person1.getAge());\r\n    Person person2 = personList.get(1);\r\n    assertEquals(&quot;Alice&quot;, person2.getName());\r\n    assertEquals(25, person2.getAge());\r\n}\r\n<\/code><\/pre>\n<p>Here, we call each method and verify that the contents of the returned list are as we expected.<\/p>\n<p>Let&#8217;s add a similar test for map conversions:<\/p>\n<pre class=\"code-fence\"><code class=\"language-java\">@Test\r\nvoid givenJsonNode_whenConvertingToMap_thenFieldsAreCorrect() throws IOException {\r\n    Map&lt;String, Person&gt; personMap1 = JsonNodeConversionUtil.manualJsonNodeToMap(idToPersonNode);\r\n    Map&lt;String, Person&gt; personMap2 = JsonNodeConversionUtil.readValueJsonNodeToMap(idToPersonNode);\r\n    Map&lt;String, Person&gt; personMap3 = JsonNodeConversionUtil.convertValueJsonNodeToMap(idToPersonNode);\r\n    validateMapOfPersons(personMap1);\r\n    validateMapOfPersons(personMap2);\r\n    validateMapOfPersons(personMap3);\r\n}\r\nprivate void validateMapOfPersons(Map&lt;String, Person&gt; map) {\r\n    assertEquals(2, map.size());\r\n    Person person1 = map.get(&quot;1234&quot;);\r\n    assertEquals(&quot;John&quot;, person1.getName());\r\n    assertEquals(30, person1.getAge());\r\n    Person person2 = map.get(&quot;1235&quot;);\r\n    assertEquals(&quot;Alice&quot;, person2.getName());\r\n    assertEquals(25, person2.getAge());\r\n}\r\n<\/code><\/pre>\n<h3  id=\"bd-63-testing-custom-deserializer\" data-id=\"63-testing-custom-deserializer\">6.3. Testing Custom Deserializer<\/h3>\n<div class=\"bd-anchor\" id=\"63-testing-custom-deserializer\"><\/div>\n<p>Let&#8217;s see how to use the custom deserializer and then compare the results:<img class=\"code-fence-highlighter-copy-button-icon\" \/><\/p>\n<pre class=\"code-fence\"><code class=\"language-java\">@Test\r\nvoid givenJsonNode_whenConvertingToListWithCustomDeserializer_thenFieldsAreCorrect() throws IOException {\r\n    ObjectMapper objectMapper = new ObjectMapper();\r\n    SimpleModule module = new SimpleModule();\r\n    module.addDeserializer(List.class, new CustomPersonListDeserializer());\r\n    objectMapper.registerModule(module);\r\n    List&lt;Person&gt; personList = objectMapper.convertValue(personsNode, new TypeReference&lt;List&lt;Person&gt;&gt;() {\r\n    });\r\n    validateList(personList);\r\n}\r\n<\/code><\/pre>\n<p><strong>Here, we first wrap the <em>CustomPersonListDeserializer<\/em>\u00a0in a module using the\u00a0<em>SimpleModule<\/em> class.\u00a0Then, we register this module with the\u00a0<em>ObjectMapper<\/em>\u00a0instance.\u00a0<\/strong>By doing this,\u00a0we instruct the\u00a0<em>ObjectMapper<\/em>\u00a0to use\u00a0<em>CustomPersonListDeserializer<\/em>\u00a0whenever a\u00a0<em>List<\/em>\u00a0needs to be deserialized.<\/p>\n<p>When we call the\u00a0<em>convertValue()<\/em> method next, the deserializer is used to return the output list.<\/p>\n<h2  id=\"bd-7-conclusion\" data-id=\"7-conclusion\">7. Conclusion<\/h2>\n<div class=\"bd-anchor\" id=\"7-conclusion\"><\/div>\n<p>In this article, we explored how to convert Jackson&#8217;s <em>JsonNode<\/em>\u00a0into typed Java collections like\u00a0<em>List<\/em>\u00a0and\u00a0<em>Map<\/em>. We discussed multiple methods to perform this operation and tested that they all provide the same output.<\/p>\n<p>For small conversions, we may use the manual method. As the JSON size grows, using methods from Jackson&#8217;s library would be better. And if a more complex conversion is required, it would be better to provide our custom deserializer.<\/p>\n<p>As usual, the source code for the examples can be found <a href=\"https:\/\/feeds.feedblitz.com\/~\/t\/0\/0\/baeldung\/~https:\/\/github.com\/eugenp\/tutorials\/tree\/master\/json-modules\/json-conversion\">over on GitHub<\/a>.<\/p>\n<p><Img align=\"left\" border=\"0\" height=\"1\" width=\"1\" alt=\"\" style=\"border:0;float:left;margin:0;padding:0;width:1px!important;height:1px!important;\" hspace=\"0\" src=\"https:\/\/feeds.feedblitz.com\/~\/i\/896021405\/0\/baeldung\"><\/p>\n<div style=\"clear:both;padding-top:0.2em;\"><a title=\"Like on Facebook\" href=\"https:\/\/feeds.feedblitz.com\/_\/28\/896021405\/baeldung\"><img decoding=\"async\" height=\"20\" src=\"https:\/\/assets.feedblitz.com\/i\/fblike20.png\" style=\"border:0;margin:0;padding:0;\"><\/a>&#160;<a title=\"Pin it!\" href=\"https:\/\/feeds.feedblitz.com\/_\/29\/896021405\/baeldung,https%3A%2F%2Fwww.baeldung.com%2Fwp-content%2Fuploads%2F2021%2F09%2FJava-7-Featured-1024x536.png\"><img decoding=\"async\" height=\"20\" src=\"https:\/\/assets.feedblitz.com\/i\/pinterest20.png\" style=\"border:0;margin:0;padding:0;\"><\/a>&#160;<a title=\"Post to X.com\" href=\"https:\/\/feeds.feedblitz.com\/_\/24\/896021405\/baeldung\"><img decoding=\"async\" height=\"20\" src=\"https:\/\/assets.feedblitz.com\/i\/x.png\" style=\"border:0;margin:0;padding:0;\"><\/a>&#160;<a title=\"Subscribe by email\" href=\"https:\/\/feeds.feedblitz.com\/_\/19\/896021405\/baeldung\"><img decoding=\"async\" height=\"20\" src=\"https:\/\/assets.feedblitz.com\/i\/email20.png\" style=\"border:0;margin:0;padding:0;\"><\/a>&#160;<a title=\"Subscribe by RSS\" href=\"https:\/\/feeds.feedblitz.com\/_\/20\/896021405\/baeldung\"><img decoding=\"async\" height=\"20\" src=\"https:\/\/assets.feedblitz.com\/i\/rss20.png\" style=\"border:0;margin:0;padding:0;\"><\/a>&#160;<a rel=\"NOFOLLOW\" title=\"View Comments\" href=\"https:\/\/www.baeldung.com\/java-jackson-jsonnode-collection#respond\"><img decoding=\"async\" height=\"20\" style=\"border:0;margin:0;padding:0;\" src=\"https:\/\/assets.feedblitz.com\/i\/comments20.png\"><\/a>&#160;<a title=\"Follow Comments via RSS\" href=\"https:\/\/www.baeldung.com\/java-jackson-jsonnode-collection\/feed\"><img decoding=\"async\" height=\"20\" style=\"border:0;margin:0;padding:0;\" src=\"https:\/\/assets.feedblitz.com\/i\/commentsrss20.png\"><\/a>&#160;<\/div>\n\n<h2><b>Commercials Cooperation Advertisements:<\/b><\/h2>\r\n<p><br>(1) IT Teacher IT Freelance<br> <\/p>\r\n<a href=https:\/\/itteacheritfreelance.hk\/wordpress><img src=http:\/\/gamefootballmobileanimeiphone.com\/wp-content\/uploads\/2023\/09\/ITTeacherITFreelance-Website.png alt=IT\u96fb\u8166\u88dc\u7fd2 java\u88dc\u7fd2 \u70ba\u5927\u5bb6\u914d\u5c0d\u96fb\u8166\u88dc\u7fd2,IT freelance, \u79c1\u4eba\u8001\u5e2b, PHP\u88dc\u7fd2,CSS\u88dc\u7fd2,XML,Java\u88dc\u7fd2,MySQL\u88dc\u7fd2,graphic design\u88dc\u7fd2,\u4e2d\u5c0f\u5b78ICT\u88dc\u7fd2,\u4e00\u5c0d\u4e00\u79c1\u4eba\u88dc\u7fd2\u548cFreelance\u81ea\u7531\u5de5\u4f5c\u914d\u5c0d\u3002\/><\/a><p><a href=https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/findteacher>\u7acb\u523b\u8a3b\u518a\u53ca\u5831\u540d\u96fb\u8166\u88dc\u7fd2\u8ab2\u7a0b\u5427! <\/a><br>\r\n\r\n\u7535\u5b50\u8ba1\u7b97\u673a -\u6559\u80b2 -IT \u96fb\u8166\u73ed\u201d ( IT\u96fb\u8166\u88dc\u7fd2 ) \u63d0\u4f9b\u4e00\u500b\u65b9\u4fbf\u7684\u7535\u5b50\u8ba1\u7b97\u673a \u6559\u80b2\u5e73\u53f0, \u70ba\u5927\u5bb6\u914d\u5c0d\u4fe1\u606f\u6280\u672f, \u96fb\u8166 \u8001\u5e2b, IT freelance \u548c programming expert. \u8b93\u5927\u5bb6\u65b9\u4fbf\u5730\u5c31\u80fd\u627e\u5230\u5408\u9069\u7684\u96fb\u8166\u88dc\u7fd2, \u96fb\u8166\u73ed, \u5bb6\u6559, \u79c1\u4eba\u8001\u5e2b.  <br>\r\n\r\nWe are a education and information platform which you can find a IT private tutorial teacher or freelance. <br>\r\n\r\nAlso we provide different information about information technology, Computer, programming, mobile, Android, apple, game, movie, anime, animation\u2026 \r\n<\/p>\n<p><br>(2) ITSec<br> <\/p><a href=https:\/\/itsec.vip><img src=http:\/\/gamefootballmobileanimeiphone.com\/wp-content\/uploads\/2023\/09\/ITSec-Main-Promotion-Image.png alt= https:\/\/itsec.vip\/\r\nSecure Your Computers from Cyber Threats and mitigate risks with professional services to defend Hackers.  \r\nITSec provide IT Security and Compliance Services, including IT Compliance Services, Risk Assessment, IT Audit, Security Assessment and Audit, ISO 27001 Consulting and Certification, GDPR Compliance Services, Privacy Impact Assessment (PIA), Penetration test, Ethical Hacking, Vulnerabilities scan, IT Consulting, Data Privacy Consulting, Data Protection Services, Information Security Consulting, Cyber Security Consulting, Network Security Audit, Security Awareness Training.\/><\/a> \r\n<br><br> \r\n<p><a href=https:\/\/itsec.vip>www.ITSec.vip<\/a> <br> <br> \r\n<p><a href=https:\/\/sraa.com.hk>www.Sraa.com.hk<\/a> <br> <br> \r\n<p><a href=https:\/\/itsec.hk>www.ITSec.hk<\/a> <br> <br> \r\n<p><a href=https:\/\/penetrationtest.hk>www.Penetrationtest.hk<\/a> <br> <br> \r\n<p><a href=https:\/\/itseceu.uk>www.ITSeceu.uk<\/a> <br> <br> \r\nSecure Your Computers from Cyber Threats and mitigate risks with professional services to defend Hackers. <br><br>\r\nITSec provide IT Security and Compliance Services, including IT Compliance Services, Risk Assessment, IT Audit, Security Assessment and Audit, ISO 27001 Consulting and Certification, GDPR Compliance Services, Privacy Impact Assessment (PIA), Penetration test, Ethical Hacking, Vulnerabilities scan, IT Consulting, Data Privacy Consulting, Data Protection Services, Information Security Consulting, Cyber Security Consulting, Network Security Audit, Security Awareness Training. \r\n<br><br>Contact us right away. <br><br>Email (Prefer using email to contact us): <br>SalesExecutive@ITSec.vip<\/p>","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/www.baeldung.com\/wp-content\/uploads\/2021\/09\/Java-7-Featured-1024x536.png\" class=\"webfeedsFeaturedVisual wp-post-image\" alt=\"start here featured\"><\/p>\n<p>Explore different methods of converting Jackson&#8217;s raw data type\u00a0JsonNode into typed Java collections.<\/p>\n<div><a title=\"Like on Facebook\" href=\"https:\/\/feeds.feedblitz.com\/_\/28\/896021405\/baeldung\"><img decoding=\"async\" height=\"20\" src=\"https:\/\/assets.feedblitz.com\/i\/fblike20.png\"><\/a>\u00a0<a title=\"Pin it!\" href=\"https:\/\/feeds.feedblitz.com\/_\/29\/896021405\/baeldung,https%3A%2F%2Fwww.baeldung.com%2Fwp-content%2Fuploads%2F2021%2F09%2FJava-7-Featured-1024x536.png\"><img decoding=\"async\" height=\"20\" src=\"https:\/\/assets.feedblitz.com\/i\/pinterest20.png\"><\/a>\u00a0<a title=\"Post to X.com\" href=\"https:\/\/feeds.feedblitz.com\/_\/24\/896021405\/baeldung\"><img decoding=\"async\" height=\"20\" src=\"https:\/\/assets.feedblitz.com\/i\/x.png\"><\/a>\u00a0<a title=\"Subscribe by email\" href=\"https:\/\/feeds.feedblitz.com\/_\/19\/896021405\/baeldung\"><img decoding=\"async\" height=\"20\" src=\"https:\/\/assets.feedblitz.com\/i\/email20.png\"><\/a>\u00a0<a title=\"Subscribe by RSS\" href=\"https:\/\/feeds.feedblitz.com\/_\/20\/896021405\/baeldung\"><img decoding=\"async\" height=\"20\" src=\"https:\/\/assets.feedblitz.com\/i\/rss20.png\"><\/a>\u00a0<a rel=\"NOFOLLOW\" title=\"View Comments\" href=\"https:\/\/www.baeldung.com\/java-jackson-jsonnode-collection#respond\"><img decoding=\"async\" height=\"20\" src=\"https:\/\/assets.feedblitz.com\/i\/comments20.png\"><\/a>\u00a0<a title=\"Follow Comments via RSS\" href=\"https:\/\/www.baeldung.com\/java-jackson-jsonnode-collection\/feed\"><img decoding=\"async\" height=\"20\" src=\"https:\/\/assets.feedblitz.com\/i\/commentsrss20.png\"><\/a>\u00a0<\/div>\n","protected":false},"author":2099,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-container-style":"default","site-container-layout":"default","site-sidebar-layout":"default","disable-article-header":"default","disable-site-header":"default","disable-site-footer":"default","disable-content-area-spacing":"default","footnotes":""},"categories":[22],"tags":[61,122,127,129,124,128,125,132,131,133,126,130,123,66,94,88,97,56,64,65,60,112,40,75,95,104,33,120,105,101,98,115,30,29,41,86,70,69,68,72,71,26,118,108,87,46,55,48,52,54,51,50,83,62,58,57,29697,109,35,59,63,85,79,82,96,80,27,81,114,44,42,43,45,38,39,110,117,100,111,116,73,89,90,92,91,93,84,78,37,102,34,36,77,67,74,99,113,119,28,121,32,47,49,53,103,31,76],"class_list":["post-121222","post","type-post","status-publish","format-standard","hentry","category-mobile","tag-airpods","tag-anime","tag-anime-characters","tag-anime-cosplay","tag-anime-edits","tag-anime-merchandise","tag-anime-movies","tag-anime-news","tag-anime-recommendations","tag-anime-reviews","tag-anime-series","tag-anime-streaming","tag-animes","tag-app-store","tag-app-store-samsung","tag-appgallery","tag-appgallery-oneplus","tag-apple","tag-apple-music","tag-apple-tv","tag-apple-watch","tag-bbc-sport","tag-best-mobile-games","tag-bixby","tag-bixby-xiaomi","tag-champions-league","tag-cyberpunk","tag-cyberpunk-2077","tag-fantasy-football","tag-fifa","tag-football","tag-formula-1","tag-fortnite","tag-free-fire","tag-free-mobile-games","tag-freebuds-pro","tag-galaxy-a52","tag-galaxy-note-20","tag-galaxy-s21","tag-galaxy-watch-4","tag-galaxy-z-fold-3","tag-game","tag-games","tag-golf","tag-harmonyos","tag-how-to-backup-iphone","tag-how-to-factory-reset-iphone","tag-how-to-reset-iphone","tag-how-to-restore-iphone","tag-how-to-unlock-iphone","tag-how-to-unlock-iphone-5","tag-how-to-unlock-iphone-6","tag-huawei","tag-ios","tag-ipad","tag-iphone","tag-json","tag-live-soccer","tag-lol","tag-macbook","tag-macos","tag-mate-40-pro","tag-mi-11-lite","tag-mi-home-security-camera-basic-1080p","tag-mi-home-security-camera-basic-1080p-huawei","tag-mi-smart-band-6","tag-minecraft","tag-miui","tag-mlb-scores","tag-mobile-game-design","tag-mobile-game-development","tag-mobile-game-marketing","tag-mobile-game-monetization","tag-mobile-games","tag-mobile-gaming","tag-nba-scores","tag-nba-standings","tag-nfl","tag-nfl-scores","tag-nhl-scores","tag-one-ui","tag-oneplus","tag-oneplus-9-pro","tag-oneplus-buds-pro","tag-oneplus-nord-ce-5g","tag-oxygenos","tag-p40-pro-plus","tag-poco-x3-pro","tag-pokemon","tag-premier-league","tag-pubg","tag-pubg-mobile","tag-redmi-note-10-pro","tag-samsung","tag-samsung-pay","tag-soccer","tag-sports","tag-steam","tag-steeam","tag-top-10-anime","tag-valorant","tag-when-do-the-iphone-7-come-out","tag-when-does-the-iphone-7-come-out","tag-when-is-the-iphone-7-coming-out","tag-world-cup","tag-xbox-series-x","tag-xiaomi"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/gamefootballmobileanimeiphone.com\/index.php\/wp-json\/wp\/v2\/posts\/121222","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gamefootballmobileanimeiphone.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gamefootballmobileanimeiphone.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gamefootballmobileanimeiphone.com\/index.php\/wp-json\/wp\/v2\/users\/2099"}],"replies":[{"embeddable":true,"href":"https:\/\/gamefootballmobileanimeiphone.com\/index.php\/wp-json\/wp\/v2\/comments?post=121222"}],"version-history":[{"count":1,"href":"https:\/\/gamefootballmobileanimeiphone.com\/index.php\/wp-json\/wp\/v2\/posts\/121222\/revisions"}],"predecessor-version":[{"id":121228,"href":"https:\/\/gamefootballmobileanimeiphone.com\/index.php\/wp-json\/wp\/v2\/posts\/121222\/revisions\/121228"}],"wp:attachment":[{"href":"https:\/\/gamefootballmobileanimeiphone.com\/index.php\/wp-json\/wp\/v2\/media?parent=121222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gamefootballmobileanimeiphone.com\/index.php\/wp-json\/wp\/v2\/categories?post=121222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gamefootballmobileanimeiphone.com\/index.php\/wp-json\/wp\/v2\/tags?post=121222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}