'Postman- Use collection variable in request body

I have a problem with Postman, where I want to use collection variables inside the request body. According to postman documentation, all variables in postman GUI can be retrieved with double curly braces {{}}. But it does not work for me. If I move variables from collection to environment, everything is working OK, but as soon as I move the variable from the environment to collection, it starts throwing errors like this:

JSONError: Unexpected token 'U' at 1:1
Unrecognized token 'Backend': was expecting (JSON String, Number, Array, Object

This is my body:

{
    "name": {{BackendValidationPSName}},
    "groups": {{myBackendValidationRGuuids}}
}

Can anyone point me in the right direction? Tx.



Solution 1:[1]

The values have to be in double quotes

{
    "name": "{{BackendValidationPSName}}",
    "groups": "{{myBackendValidationRGuuids}}"
}

Solution 2:[2]

Solved. I was missing the "" in the collection variable value.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Austin Jerry
Solution 2 Asmerito