Read packer dictionary variable


I have packer variable file “packer.json” like this
“region-A”: {
“region” : “A”
“region-B”: {
“region”: “B”

if I call packer build -var=region_name=regionA., how do I access the values under “region-A” in a builder section

like this -
builder {
region_name: “{{ region_name }}.region”. -> which should load value “A”

Basically I want to read a variable in dictionary and access the specific key in builder sections.

Please let me how I can achieve this…