I'm creating a velocity template to which I pass a map, and I want to get only the keys with values.
It is my code:
#set ($value = $map.get($key))
#if($value != "")
"$key": "$value",
#end
It prints: $value
Just try:
#if($value)
"$key": "$value",
#end
It will filter out null and empty values.