Error with Date formatting in API call

0
Hi makers, I'm consuming a REST service and ran up to an annoying error that the formatter in Mendix recognizes  "DateBooked": "/Date(1553727600000+0100)/", as a DateTime attribute in the JSON structure...     ...but when using the importmapping based on this JSON, I get the following error:   com.mendix.systemwideinterfaces.MendixRuntimeException: Can't parse date from value 'Failure(java.time.format.DateTimeParseException: Text '/Date(1487026800000+0100)/' could not be parsed at index 0)'     at com.mendix.integration.importer.handlers.ObjectMappingHandler.com$mendix$integration$importer$handlers$ObjectMappingHandler$$setMemberValue(ObjectMappingHandler.scala:225) Does anybody know a workaround for this?    *Update* Ok, was hoping to avoid the hassle but think I got it covered with the suggestions of Ronald and Cillus. So long as its available, here's the modelshare with Find(2x), Substring, Parse and CommunityCommons.LongToDateTime.. https://modelshare.mendix.com/models/6d71aa96-c869-464d-9d52-b7cd11fe4817/parsedatetime   
asked
2 answers
1

I would just make it a string and do the parsing yourself.

Regards,

Ronald

 

answered
1

Change the "/Date(1553727600000+0100)/" in “Sjors the Maker”
Then you know for sure it will be a string in your mapping.

Then you have to be creative with parseDateTime e.d. :-)
 

answered