I receive an id and a timestamp from a query, and when I try to output the timestamp I receive an invalid property error. I am using ojdbc7.jar, Dataweave 2.0, and Mule 4.
Using a Transform Message I can output payload.ID[0] without issue. I tried coercing the timestamp to DateTime and formatting it as a String but it still fails.
Below works
%dw 2.0
output application/json
---
payload.ID[0]
Below gives error "Invalid property name: shareBytes
on class oracle.sql.TIMESTAMP
. Validate that the correct setters is presen, while writing Json at payload.CREATED_DATE.shareBytes." evaluating expression: "%dw 2.0."
%dw 2.0
output application/json
---
payload.CREATED_DATE[0]
Below gives error "Cannot coerce Object { class: oracle.sql.TIMESTAMP } (org.mule.weave.v2.module.pojo.reader.JavaBeanObjectValue@6f5eee28) to String"
%dw 2.0
output application/json
---
payload.CREATED_DATE as String {format: "dd-MMM-yy h:mm:s"}
I expected the second or third example to return the timestamp.