Question: I have a small script

```
ABC=100000
DFG=600000

JSON="[{"Address":"$ABC","Backup":false,"name":"$ABC:11011","port":6745,"targetId":"$DFG","weight":1}]"

echo $JSON

```

I get the output as

```
[{Address:$ABC,Backup:false,name:$ABC:11011,port:6745,targetId:$DFG,weight:1}]

```

can someone please help me in this case
T.I.A

Answer: 
Your double-quoted string contains double quotes.

You can escape all the inner quotes that you want to keep:

```bash
JSON="[{\"Address\":\"$ABC\",\"Backup\":false,\"name\":\"$ABC:11011\",\"port\":6745,\"targetId\":\"$DFG\",\"weight\":1}]"

```

You can use a single quoted string, interrupted where the variables go (this is hard to read):

```bash
JSON='[{"Address":"'"$ABC"'","Backup":false,"name":"'"$ABC"':11011","port":6745,"targetId":"'"$DFG"'","weight":1}]'

```

You can use printf with a single quoted format string:

```bash
printf -v JSON '[{"Address":"%s","Backup":false,"name":"%s:11011","port":6745,"targetId":"%s","weight":1}]' "$ABC" "$ABC" "$DFG"

```

Or, use a JSON-processing tool to handle any edge cases with the values of the variables:

```bash
JSON=$(
  jq -n -c --arg a "$ABC" --arg b "$DFG" '[{
    Address: $a, 
    Backup: false,
    name: ($a + ":11011"),
    port: 6745,
    targetId: $b,
    weight: 1
  }]'
)
echo "$JSON"

```

That outputs

```json
[{"Address":"100000","Backup":false,"name":"100000:11011","port":6745,"targetId":"600000","weight":1}]

```
You can also use a here document to populate the variable with a JSON structure in expanded form that can be easier for people to read and maintain, and substitute shell variable values into the middle without a lot of backslashes to escape quote characters:

```
f_name=Sotto
l_name=Voce
JSON=$(cat - <<EOJSON
{
  "first_name": "${f_name}",
  "last_name": "${l_name}",
  "full_name": "${f_name} ${l_name}"
}
EOJSON
)

```

Then `echo "${JSON}"` or `echo "$JSON"` outputs:

```
{
  "first_name": "Sotto",
  "last_name": "Voce",
  "full_name": "Sotto Voce"
}

```

My personal style uses curly braces around variable names everywhere, but it's not required here. Using `$f_name` also works in this example.

I've come to think of here documents as another type of string quoting. Since single- or double-quotes aren't being used to quote the whole string, you don't usually need to escape them with backquotes.