I am working with jq and I am trying to add a new JSON object to a new key to an existing file.

I have the following JSON file, **foobarbaz.json** :

```
{
    "example":{
        "name": "stackOverflowQuestion"
    }
}

```

I want to add a new entry under example, so to get the following output in **foobar.json**

```
{
    "example": {
        "name": "stackOverflowQuestion",
        "new": {
            "newfield": {
                "key": "value"
            }
        }
    }
}

```

I am using the following commands in the terminal:

```
$ tempvar='{"newfield":{"key":"value"}}'
$ cat foobarbaz.json | jq '.example.new=env.tempvar' > foobar.json

```

However, the output in **foobar.json** is somewhat unexpected:

```
{
  "example": {
    "name": "stackOverflowQuestion",
    "new": "{\"newfield\":{\"key\":\"value\"}}"
  }
}

```

Why does jq wrap the curly brackets with quotes, and why does it escape the double quotes?