Skip to main content

Hi Team 

 

I have published segment in SFMC from data cloud whihc uses relative attributes of DMOs. Because of these relative attributes the data is coming in JSON format. 

 

I am using SSJS script to parse this data however script worked for few records but failing for large data. I have to parse around 3 lakh records or may be more than that. 

 

Is there any other solution to parse segment data so that I can use it further.

5 réponses
  1. 21 août, 15:23

    Got it - if you need every value, not the latest, then scrap the ROW_NUMBER part. But the batch-time pain is the real signal: SSJS is row-by-row and single-threaded, so parsing every subscriber's JSON in-journey will always be slow (your 20-min batches) and blow the journey timing. The fix is to get that work off SSJS entirely. Two reliable ways, both needing one change: land the related data as ROWS - a normalized child DE, one row per value keyed by SubscriberKey - instead of a JSON array in one cell. 

     

    1. Best for 'all values': AMPscript at send time. Keep that child DE and in the email use LookupRows(childDE, 'SubscriberKey', subkey) with a loop to render all of a subscriber's values inline. Each send only touches that one subscriber's rows - no giant pre-parse job, nothing to time out, and it naturally handles however many values a person has. 

     

    2. Or pre-flatten with a SQL Query Activity. It is set-based (whole dataset at once, minutes not hours), so it scales where SSJS cannot. Concatenate all values per person into one delimited field using the FOR XML PATH pattern - note SFMC's SQL engine does not support STRING_AGG, so FOR XML PATH is the way. Output a flat sendable DE. 

     

    Either path removes the SSJS bottleneck; option 1 usually wins when the value-count per person is unbounded. 

     

    If this sorts it, a Best Answer mark would help the next person hitting the same JB timeout wall 🙂

0/9000