[#1838] Escape % from all strings that may have them

The problem we faced when doing format() twice was that if someone passed a
query with "{}", it'll look confuse the second format(). For example, the
query:

```json
{
    filters: {
        "country": "{test}"
    }
}
```

It'll confuse the second format(). So, instead of doing two formats to escape
%, we escape % before running it.