String: Explode to an array

Hello,

I have a string that looks like this:

{
  "sku":"1x130F1002P2/2x023F35/1x044F7248"
}

If I use a value mapper of String: Explode with the delimiter I end up with:

{
  "sku": [
    "1x130F1002P2",
    "2x023F35",
    "1x044F7248"
  ]
}

How do I go about getting this to look similar to:

{
  "sku": [
    {
      sku:  "1x130F1002P2"
    },
   {
      sku:  "2x023F35"
    },
   {
      sku:  "1x044F7248"
    }
  ]
}

Cant quite figure out how to get that new sku key in there with the appropriate value.

@steven.ferrell I don’t think that’s possible exclusively using mappers. You will need to use the Move using a pattern transformer with the following parameters:
Pattern: sku.*
Replacement: sku.$1.sku

1 Like

ah, excellent idea. Thanks!