Write Jackson Custom Deserializer for a particular attribute in an hierarchical JSON map
<p>JSON Object:<code></p>

<pre><code>["emp" : {
        "departments": [
            "modules": [
                {
                    "tasks": [
                        {
                            "resources": 100,
                            "notes": "" 
                        }
                    ]
                }
            ]
        ]
    }]
</code></pre>

<p></code>
I would want to map the above JSON onto a <code>List&lt;Emp&gt;</code>object. My object mapper would look like:<br>
<code><code>List&lt;Emp&gt; emps = Arrays.asList(mapper.readValue(jsonString, Emp[].class));</code></code></p>

<p>This simple object mapper works well.<br>
My problem is I have to deserialize <code>tasks</code> object from the JSON on to the <code>Task</code> object in a different manner.</p>

<p>I understand that we can write a custom deserializer using jackson, but that is not solving my case.
I have written a <code>CustomeDeserializer</code> for the <code>Task</code> object, but registering this to the Object Mapper as follows would try to serialize the whole JSON (<code>List&lt;Emp&gt;</code>) as a a task object.<code></p>

<pre><code>SimpleModule mod = new SimpleModule("MyModule");
      ObjectMapper mapper = new ObjectMapper();

      mod.addDeserializer(Task.class,
          new CustomDeserializer(Task.class));
      mapper.registerModule(mod);
</code></pre>

<p></code><br>
Is there a way to specify the <code>CustomDeserializer</code> only for a particular attribute during parsing?
Or is there an alternative for this ?</p>

<p>Note: I cannot change my DTO's to fix this.</p>