Help Needed: Creating JSON data structure

I’m working on a video automation scenario using JSON2Video’s API and need help implementing their CNN-style lower-third component (basic/050). Currently, my scenario processes videos from Airtable records, but I’m having trouble with the JSON structure when trying to add the lower-third component.

This is a combined JSON structure with video element and CNN-style component

{
“elements”: [
{
“src”: “{{28.url}}”, // Your video URL from the feeder
“type”: “video”,
“zoom”: 0,
“width”: “{{56.output_width}}”,
“height”: “{{56.output_height}}”,
“duration”: “-1”,
“position”: “center-center”
},
{
“type”: “component”,
“component”: “basic/050”,
“settings”: {
“card”: {
“vertical-align”: “bottom”
},
“headline”: {
“text”: “{{56.hooks}}”,
“font-size”: “auto”
},
“lead”: {
“text”: “{{56.call_to_actions}}”,
“font-size”: “auto”
}
},
“start”: 3
}
]
}

The Challenge: When trying to generate a single JSON data structure with both elements, Make’s Create JSON module only creates the video element and ignores the component element. it seems the “create json module” cannot correctly handle key : [array of values]

I need guidance on:

  1. Correct approach to combine these elements

Any help or examples would be greatly appreciated!

Hi @ideaurbs and welcome to the Make Community!

What are you getting as input and what are you getting as output, and what are you expecting?

L

@L_Duperval

Hi, thanks for the response!

Input:

From Airtable I’m getting these fields:

  • URL for video ({{28.url}})
  • Video dimensions ({{56.output_width}} and {{56.output_height}})
  • Text for headline ({{56.hooks}})
  • Text for lower third ({{56.call_to_actions}})

Current Output:

When I try to create a data structure in the JSON module using my template, it only generates options for the video element:

{
“elements”: [
{
“src”: “video_url”,
“type”: “video”,
“zoom”: 0,
“width”: 1920,
“height”: 1080,
“duration”: -1,
“position”: “center-center”
}
]
}

Expected Output:

I need both the video element AND the CNN-style component in the structure:

{
“elements”: [
{
“src”: “video_url”,
“type”: “video”,
“zoom”: 0,
“width”: 1920,
“height”: 1080,
“duration”: -1,
“position”: “center-center”
},
{
“type”: “component”,
“component”: “basic/050”,
“settings”: {
“card”: {
“vertical-align”: “bottom”
},
“headline”: {
“text”: “headline_text”,
“font-size”: “auto”
},
“lead”: {
“text”: “lead_text”,
“font-size”: “auto”
}
},
“start”: 3
}
]
}

The JSON module seems to ignore the second element (component) when generating the data structure. Do I need to handle this differently, perhaps with separate JSON modules?

HI @ideaurbs,

I’m curious: Why are you getting the URL from the iterator instead of the Airtable data? That may explain the problem. Did you try taking all the data form the iterator (28) instead of Airtable?

I’m pretty sure the JSON parser can handle much more complex JSON structures than the one you present here, so I’m not convinced that’s the problem.

If you’re not getting the results you want, then send a follow-up with this information:

  • The input and output bundles of the various modules
  • An export of your scenario blueprint. You can do that by clicking the three buttons at the bottom of your scenario and choosing “export blueprint” then attach it with your response.

L

Hi @L_Duperval,

Thanks for helping out, if you were to take the exact json structure I posted at the beginning and paste it in the “Create JSON Module” i.e. “generate” you will find out that only the first part is generated regardless of any connections.

OK, I see what you mean.

Can you try a different approach? Some possibilities: create three colections instaad of an array of collections then at the end, use a text aggregator to recreate the JSON format you wnat.

Or can you just use text throughout and make sure your text is formatted properly as JSON. It’s a bit more manual but you have more control.

L