Reputation: 123
I want to transform a LinkedHashMap
Payload to Object
Payload in mule , i used the Byte Array to Object transformer but it dosent work for me , any idea guys ?
Upvotes: 0
Views: 4420
Reputation: 12933
You seem to mention specifically the Object type. A LinkedHashMap is already an instance of Object: every Java instances inherit from the root class Object.
If you want to transform your HashMap into a specific object such as JSON or a custom object such as com.mycompany.CompData, you have several possibilities depending on your use case:
Se the docs for details: https://docs.mulesoft.com/mule-user-guide/v/3.8/using-transformers
If you may be more specific as to what your use case is I'll gladly refine my answer ;)
Upvotes: 0
Reputation: 2694
you can use dataweave to transform a payload of generic type (=java.util.Map
) to a specific type (foo.bar.Type
in the example):
%dw 1.0
%output application/java
---
payload as :object {
class: "foo.bar.Type"
}
Upvotes: 1