Articles in this section

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:

Source data (input) Transformed data (output)
items[*].name products[*].name
items[*].price products[*].price
items[*].flavors[*].weight products[*].weight
items[*].flavors[*].scent products[*].scent
items[*].flavors[*].color products[*].color

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
    }
  ]
}
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.