Transformation 1.0: Transform an array within an array

If you have an array within an array in a record and you want to transform, use the following example: 

Input:

{
 "Items": [
  {
   "Name": "perfume",
   "Price": 50, 
   "Flavors": [
   {
    "Weight": 3.14, 
    "Scent": "Obsession",
    "Color": “black”
   },
   {
    "Weight": 3.41,
    "Scent": "Cool waters",
    "Color": "Black"
   }
  ]
 }

Rules:

Output:

{
  "products": [
    {
      "color": "Black",
      "scent": "Obsession",
      "weight": 3.14,
      "name": "perfume",
      "price": 50
    },
    {
      "color": "Black",
      "scent": "Cool waters",
      "weight": 3.41,
      "name": "perfume",
      "price": 50
    }
  ]
}

Leave a comment

Your email address will not be published. Required fields are marked *