In Java get same output as endpoint engine-rest/task

Hi,
For the endpoint engine-rest/task I get this result:
[
{
“id”: “1a5a1386-2008-11eb-824c-04ed33e97cae”,
“name”: “temp test”,
“assignee”: null,
“created”: “2020-11-06T09:14:33.886+0100”,
“due”: null,
“followUp”: null,
“delegationState”: null,
“description”: null,
“executionId”: “1a54953b-2008-11eb-824c-04ed33e97cae”,
“owner”: null,
“parentTaskId”: null,
“priority”: 50,
“processDefinitionId”: “exampleTask:1:10ed8245-2008-11eb-824c-04ed33e97cae”,
“processInstanceId”: “1a54953b-2008-11eb-824c-04ed33e97cae”,
“taskDefinitionKey”: “Activity_1jsn08e”,
“caseExecutionId”: null,
“caseInstanceId”: null,
“caseDefinitionId”: null,
“suspended”: false,
“formKey”: null,
“tenantId”: null
}
]

but when I try to do the same in Java with this:
camunda.getTaskService().createTaskQuery().list().toString();
I get this result:
[Task[1a5a1386-2008-11eb-824c-04ed33e97cae]]

How do I get the same result as above in Java?

/Hugo

When you use .toString() on result set it will print hashcode of the task object, I’m assuming that taskid was been used to implement the hashcode.

Anyway why can’t you iterate the result set and access the properties from the task object rather than using toString method? If you prefer response as json string format then use any standard json library to convert pojo to json string.

1 Like

Yes it is possible to access all properties and it is possible to iterate over all, thought more if I had missed something if it had already been done :slight_smile:

Thanks, now I know