Hello,

We are encountering an issue with the Olingo library when deserializing
JSON payloads into OData entities, specifically with properties of type
Edm.DateTimeOffset.

Here is the method we are using for deserialization, where str is the JSON
payload:


public ClientEntity loadEntity(String str) throws ODataDeserializerException {
    InputStream stream = new
ByteArrayInputStream(str.getBytes(StandardCharsets.UTF_8));
    return 
client.getBinder().getODataEntity(client.getDeserializer(ContentType.APPLICATION_JSON).toEntity(stream));
}

When the payload is as follows:

{
  "employeeHireDate": "2025-01-01T00:00:00Z"
}

The employeeHireDate property is deserialized as Edm.String instead of
Edm.DateTimeOffset. However, when we explicitly include the @odata.type
 annotation:

{
  "employeeHireDate": "2025-01-01T00:00:00Z",
  "employeehired...@odata.type": "#Edm.DateTimeOffset"
}

It is correctly deserialized as Edm.DateTimeOffset.

Is this behavior expected? Is there a way to configure Olingo to infer
types like DateTimeOffset automatically without requiring the
@odata.type annotation
in the JSON payload?

Any guidance would be greatly appreciated!

Thank you

-- 


The contents of this message are confidential.  If you are not the 
intended recipient of this communication, kindly contact the sender 
immediately and permanently delete this message.

Reply via email to