Filter customization lines (after nested Iterator) and build clean JSON per SKU

Hi everyone,

I’m working on a Make scenario to process order line items (skus[]), each of which may include up to 3 optional customization fields:

*gravure (engraving)

  • monogramme (monogram)
  • surMesure (custom size)

:inbox_tray: Input structure (from API):

I receive data in the following format:

"id": 1714
"shippings": [
  {
    "skus": [
      {
        "id": "238",
        "sku": "RD-XXX",
        "customisations": [
          {
            "title": "Gravure ..",
            "content": "ghgjhgg",
            "price": 0
          },
          {
            "title": "Monogramme : ...",
            "content": "ts",
            "price": 10
          }
        ]
      },
      {
        "id": "233",
        "sku": "KSM-F",
        "customisations": [
          {
            "title": "Gravure ...",
            "content": "jkhjljlbk",
            "price": 0
          },
          {
            "title": "Monogramme : ...",
            "content": "lk",
            "price": 10
          },
          {
            "title": "Taille Sur-Mesure...",
            "content": "taille 19",
            "price": 0
          }
        ]
      }
    ]
  }
]

So, each SKU can have 0 to 3 customizations inside a customisations[] array.


:puzzle_piece: Scenario structure:

Here’s what I’ve built so far:

  1. Iterator 1: on skus[]
  2. Set variable: id_ligne = order_id + "_" + index
  3. Iterator 2: on each sku.customisations[]
  4. 3 Set variable modules to extract:
  • gravure: if(contains(title; "Gravure") and content != emptystring; content; null)
  • monogramme: same logic
  • surMesure: same logic
  1. Set multiple variables with: id_ligne, gravure, monogramme, surMesure
  2. Filter to remove fully empty lines
  3. Array Aggregator grouped by id_ligne to build one line per SKU

:white_check_mark: Expected output:

I want to get this final JSON structure:

[
  {
    "key": "1714_1",
    "gravure": "ghgjhgg",
    "monogramme": "ts",
    "surMesure": null
  },
  {
    "key": "1714_2",
    "gravure": "jkhjljlbk",
    "monogramme": "lk",
    "surMesure": "taille 19"
  }
]

:check_mark: Each object = a single SKU
:check_mark: Only lines where at least one field is filled are kept
:check_mark: Empty fields appear as null


:cross_mark: Issue:

Despite using a variable like hasCustomisation with this logic:

gravure != null or monogramme != null or surMesure != null

…and applying a filter before the aggregator, Make still includes empty lines (with all 3 fields null). It seems the filter works at the bundle/operation level, not at the item level from the nested Iterator.


:red_question_mark:What I’m looking for:

  • How can I reliably filter customization lines one by one, after the second Iterator?
  • Aggregate only valid SKUs with at least one filled field?
  • Return a final flat array of JSON objects as shown above?

Thanks in advance to anyone who can share a working logic or workaround!

Hey Vaam,

something like this?

blueprint (9).json (8.3 KB)

Update — Issue solved
Thanks everyone! I’ve found a working solution:

  • I’m using a single Iterator on skus[]
  • For customisations[], instead of a second Iterator, I use a Set Multiple Variables module with nested conditions on customisations[1], [2], and [3], since I know there will never be more than 3.
  • Each field (gravure, monogramme, surMesure) is extracted with a conditional expression like:
{{if(contains(48.customisations[1].title; "Gravure"); 48.customisations[1].content; if(contains(48.customisations[2].title; "Gravure"); 48.customisations[2].content; if(contains(48.customisations[3].title; "Gravure"); 48.customisations[3].content; null)))}}  
  • Then I use an Array Aggregator on the skus[] iterator to build a clean final array.
    :white_check_mark: Result: each SKU line includes only valid fields, empty fields are null, and fully empty lines are excluded.
    Thanks again to the community!
2 Likes