How to check if variable exist in json

Hi, Camunda community.

I work on camunda modeler + spring boot and I want to do 2 things

First, I want to check is variable exists
${group1.variable1 != null} this is working but
execution.hasVariable(“group1.variable1”) is not working it always return false.
Is there anyway to make hasVariable works with this way of variable.

Second question, in modeler I have this script
["string1","string2"] which expected to return list of string, but in Java I use execution.getVariable(“myVar”) its return Object and I cannot cast to List please help.

Thankyou