# How to check if variable exist in json

**URL:** <https://forum.camunda.io/t/how-to-check-if-variable-exist-in-json/25568>\
**Category:** Discussion & Questions\
**Created:** [February 18, 2021, 6:31am UTC](https://forum.camunda.io/t/how-to-check-if-variable-exist-in-json/25568 "2021-02-18T06:31:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![babe124578](https://forum.camunda.io/user_avatar/forum.camunda.io/babe124578/32/13270_2.png) [@babe124578](https://forum.camunda.io/u/babe124578)\
**Post date:** [February 18, 2021, 6:31am UTC](https://forum.camunda.io/t/how-to-check-if-variable-exist-in-json/25568/1 "2021-02-18T06:31:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://forum.camunda.io/uploads/default/original/3X/5/8/58d50142eacca605d35cb1ef9e6b86ae85f49436.png) [@system](https://forum.camunda.io/u/system)\
**Post date:** [January 30, 2024, 12:54pm UTC](https://forum.camunda.io/t/how-to-check-if-variable-exist-in-json/25568/2 "2024-01-30T12:54:12Z")

</div>

Closed on January 30, 2024, 12:54pm UTC


