<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Deserialize list of Nodes in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/deserialize-list-of-nodes/m-p/55875#M20357</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Friends&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I Get List of Nodes, then I&amp;nbsp;can not deserialize&amp;nbsp;json response, I get Error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;com.fasterxml.jackson.databind.JsonMappingException: No suitable constructor found for type [simple type, class com.alfresco.client.api.common.representation.ResultPaging&amp;lt;com.alfresco.client.api.core.model.representation.NodeRepresentation&amp;gt;]: can not instantiate from JSON object (need to add/enable type information?)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HttpClient httpClient = HttpClientBuilder.create().build();&lt;BR /&gt;&lt;SPAN&gt; HttpGet get = new HttpGet("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/-shared-/children" rel="nofollow noopener noreferrer" target="_blank"&gt;http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/-shared-/children&lt;/A&gt;&lt;SPAN&gt;");&lt;/SPAN&gt;&lt;BR /&gt; String alfrescoUser = "admin";&lt;BR /&gt; String pass = "admin";&lt;BR /&gt; UsernamePasswordCredentials creds = new UsernamePasswordCredentials(alfrescoUser, pass);&lt;BR /&gt; get.setHeader("Accept", "application/json");&lt;BR /&gt; get.setHeader("Content-type", "application/json");&lt;BR /&gt; get.setHeader(new BasicScheme().authenticate(creds, get, null));&lt;BR /&gt; HttpResponse response = httpClient.execute(get);&lt;BR /&gt; int statusCode = response.getStatusLine().getStatusCode();&lt;BR /&gt; if (statusCode != 200)&lt;BR /&gt; {&lt;BR /&gt; throw new RuntimeException("Failed with HTTP error code : " + statusCode);&lt;BR /&gt; }&lt;BR /&gt; HttpEntity httpEntity = response.getEntity();&lt;BR /&gt; String apiOutput = EntityUtils.toString(httpEntity);&lt;BR /&gt; System.out.print(apiOutput);&lt;BR /&gt; Long total = null;&lt;BR /&gt; ObjectMapper om = new ObjectMapper();&lt;BR /&gt; om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);&lt;BR /&gt; ResultPaging&amp;lt;NodeRepresentation&amp;gt; nodes = null;&lt;/P&gt;&lt;P&gt;nodes = om.readValue(apiOutput, new TypeReference&amp;lt;ResultPaging&amp;lt;NodeRepresentation&amp;gt;&amp;gt;() {});&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please, can you Help me?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 May 2018 09:48:45 GMT</pubDate>
    <dc:creator>dadamia</dc:creator>
    <dc:date>2018-05-23T09:48:45Z</dc:date>
    <item>
      <title>Deserialize list of Nodes</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/deserialize-list-of-nodes/m-p/55875#M20357</link>
      <description>Dear FriendsI Get List of Nodes, then I&amp;nbsp;can not deserialize&amp;nbsp;json response, I get Errorcom.fasterxml.jackson.databind.JsonMappingException: No suitable constructor found for type [simple type, class com.alfresco.client.api.common.representation.ResultPaging&amp;lt;com.alfresco.client.api.core.model.repre</description>
      <pubDate>Wed, 23 May 2018 09:48:45 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/deserialize-list-of-nodes/m-p/55875#M20357</guid>
      <dc:creator>dadamia</dc:creator>
      <dc:date>2018-05-23T09:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: Deserialize list of Nodes</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/deserialize-list-of-nodes/m-p/55876#M20358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the scenario where you would be remotely calling the Alfresco API (in other words, running from a system other than Alfresco) and then wanting to deserialize JSON objects using classes that you should not have access to (ie, Alfresco's)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are in a remote system you should be deserializing JSON responses into your own POJO's, not trying to reconstruct Alfresco's.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are calling the remote API from within Alfresco then you shouldn't be doing that either because you've got access to the native API.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2018 16:45:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/deserialize-list-of-nodes/m-p/55876#M20358</guid>
      <dc:creator>jpotts</dc:creator>
      <dc:date>2018-05-24T16:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Deserialize list of Nodes</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/deserialize-list-of-nodes/m-p/55877#M20359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank You Jeff&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I solve this problem:&lt;/P&gt;&lt;P&gt;I am in a remote system and I create own POJO class -&amp;nbsp; &amp;nbsp;Entry.class, then I extract information&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;List&amp;lt;&lt;SPAN&gt;EnrtyDTo&lt;/SPAN&gt;&amp;gt; &lt;SPAN&gt;entryDTos&lt;/SPAN&gt;= new ArrayList&amp;lt;&lt;SPAN&gt;EnrtyDTo&lt;/SPAN&gt;&amp;gt;();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ObjectMapper om = new ObjectMapper();&lt;/P&gt;&lt;P&gt;JsonNode jsonNodeRoot = om.readTree(apiOutput);&lt;BR /&gt; List&amp;lt;JsonNode&amp;gt; nodes = jsonNodeRoot.findValues("entry"); &lt;BR /&gt; for (JsonNode node : nodes) {&lt;BR /&gt;EnrtyDto entryDTo = om.treeToValue(node, EnrtyDto.class);&lt;BR /&gt;entryDTos.add(&lt;SPAN&gt;entryDTo&lt;/SPAN&gt;);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank All&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2018 05:48:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/deserialize-list-of-nodes/m-p/55877#M20359</guid>
      <dc:creator>dadamia</dc:creator>
      <dc:date>2018-05-25T05:48:09Z</dc:date>
    </item>
  </channel>
</rss>

