Paul Calabro
Paul Calabro

Reputation: 1906

Dataweave: JSON -> HashMap

Is there a way to convert a JSON string to a HashMap object using Dataweave? I know I can do this using the JSON to Object transformer, however, I'm unable to do do this using Dataweave. I'm running into complaints about not being able to coerce a :string to an :object.

Upvotes: 0

Views: 1630

Answers (2)

Manik Magar
Manik Magar

Reputation: 1401

You can do that without DataWeave too, like below -

<json:json-to-object-transformer
                            returnClass="java.util.HashMap" doc:name="JSON to Object" />

Upvotes: 0

Charu Khurana
Charu Khurana

Reputation: 4551

Just return a (payload) from weave. It will be a HashMap.

Upvotes: 1

Related Questions