Search code examples
dataweavemulesoftmule4

how to convert a JSON object into a JSON array in Mule 4


Input:

{ "abc": "xyz", "pqr": "def" }

Expected Output:

[ { "abc": "xyz", "pqr": "def" } ]

Expecting the output mentioned.


Solution

  • Just enclosing an object -or any construct- in bracket will return an array with that item.

    Example:

    [payload]