It would have been helpful if you had shared sample data and the expected output for debugging purpose.
However I created this sample data set in Snowflake based on what you described in the question.
Below query gives me expected output as 9 as this is the number of JSON objects in variant column.
SELECT
COUNT(*) AS total_variant_objects
FROM
my_table,
LATERAL FLATTEN(input => my_table.variants) AS flattened_variants;