I am trying to log my hashmap it looks something like this :
How do I convert it into proper json format ?
You can use the Transform Component and write the dataweave code as follows:
%dw 2.0
output application/json
---
payload pluck(message,property,index) -> {(index) :{(property) :message}}
This should work.