How to map Works JSON Object

Skip to first unread message

Will J

Jul 8, 2021, 1:56:16 PM7/8/21
to ORCID API Users

I'm having a hard time mapping the works Schema to JSON values using Java RestClient.  

Is there a place where I can find POJOs that maps ORCID info to JSON via JAVA and rest client?  Or are there any recent JAVA ORCID repos anywhere?

These are the steps that I have done so far.

1. Created a sandbox account for public api.  
2. Added information to my orcid record: Employment, Education, Works, etc..

3. Grabbed the pub sandbox url and plugged it into my properties/yml file.  
orcidPublicApiUrlWorks =<ORCID>/works

4. Tested GET commands in Swagger.

I would like to just test first before OAuth integration.

I tested with the easiest GET first<ORCID>/email
one first and I get back JSON data.    

I would assume it would be straight forward getting items if I map it correctly in my pojos using rest template like this.

WorksInput worksResults = restTemplate.getForObject(orcidPublicApiUrlWorks, WorksInput.class); 

I have approximately 30 pojos that will be used for works...see below

        WorksInput pojo below: 
private LastModifiedDate lastModifiedDate; 
private List<Group> group; 
private String path;
       LastModifiedDate Pojo Below:
       public class LastModifiedDate {
private String value; 
public String getValue(){
  return value; 
public void setValue(String input){
  this.value = input;
       Group Pojo below:   
       public class Group {
       private LastModifiedDate lastModifiedDate;
       private ExternalIds externalIds;
       private List<WorkSummary> workSummary = new ArrayList<WorkSummary>();
       private Map<String, Object> additionalProperties = new HashMap<String, Object>();
The first error message I received was this...() Then I started adding a constructor to group with a json annotation.  Didn't work.
MismatchedInputException: Cannot construct instance of `org.nrt.orcid.pojo.Group` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('2021-07-05T13:29:05.801Z')
So I went back to last modified date and got this error so I added this @JsonProperty("last-modified-date") because java doesn't accept (-) dashes in strings 
and I have to match the exact name of the data element coming back.
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `org.nrt.orcid.pojo.LastModifiedDate` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('2021-07-05T13:29:05.801Z')
This error caught my eye.  
RestClientException: Error while extracting response for type [class org.nrt.orcid.pojo.WorksInput] and content type [application/xml;charset=UTF-8];
I made some changes and now im here after adding HttpMessageConverter code.
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')

Thank you for any assistance you may provide.

Nathan Tenney

Jul 8, 2021, 4:54:20 PM7/8/21
to ORCID API Users

Here is a sample that I put together that converts the schema to POJO's. I'm making use of the gson library to do this.

You received this message because you are subscribed to the Google Groups "ORCID API Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Nathan Tenney
USU Alumni

Demeranville, Tom

Jul 9, 2021, 5:47:29 AM7/9/21
to Will J, ORCID API Users
Hi therel,

You might want to check out our Java model in Maven: 

This is the same model we use to serialize API responses in JSON, so it works really well.

Tom Demeranville
Product Director

Message has been deleted

Will J

Jul 9, 2021, 11:06:44 PM7/9/21
to ORCID API Users
Nathan,  thanks a bunch.  Your videos show a nice real life example and will definitely assist me once I get to OAuth integration.

Tom, I'm able to get data back from my Orcid.  I wasn't setting my `Content-Type` and `Accept` headers properly.  Now I will use the  Orcid  model for mapping.  Thanks again.  :)

Reply all
Reply to author
0 new messages