Conditional JSON array

Hi,
In one of my schemas, I would like to populate a JSON array only if another value is true

Let’s say, if ifParamedic value is true, I want to get a random JSON array from another dataset, but if ifParamedic value is false, I want this array empty. Actually, if false, the array is generated with null values, hence adding invalid data.

Having the array is not a problem, but is there a way to make it not generate any child if the value is false, and have the array empty, instead of having null values generated? Or maybe any other valid solution that would avoid to have null data?

Thanks in advance for your help guys!