How to Exclude data

Hi,

I have several sensors reading and sometimes the loop did not read some of one.

I made an script but did not work correctly, i did and if the variable has or no has data show or not show in the json

any one could help to me because did not works?

Thank's

if(Shum.length() !=0){ dest = dest + ""7":""+ Shum +"",";}
if(Svis.length() !=0){ dest = dest + ""8":""+ Svis +"",";}