How to enter a multi-line data string to variable using PUT in Postman

WARNING - I have very limited experience using Postman
My question: Great success using Postman when data string to replace against variable is single line:
[
{
“name”: “package_jobs_author_assign”,
“value”: “No”
}
]

However, when string contains sub-variables and requires several lines the PUT is rejected with JSON parse error:
[
{
“name”: “in_package_jobs”,
“value”: “[{“engine_model”:“LiftSystem”,“pub_number”:“60003”,“pub_type”:“HMM”,“dmc_task_chap”:“PWF135-SAA-78-60-C300-00AA-310A-C”,“doc_priority”:{“id”:null,“name”:“Routine”},“revision”:“001”,“summary”:”“}]”
}
]

I’ve already tried:
Removing the outside brackets
Changing in string double quotes " to single quote ’

Appreciate any assistance, hopefully with correct structure using above real data.
Thank you
Bill Martin

Hi @wkmartin

If you want to save an object into a variable you can use backticks instead of quotes.

This character `

Usually located under the ‘esc’ key top left of your keyboard.

Thanks @wkmartin for posting.
Basically, the first variable is a table containing an object.
You can generate a pre-request in Postman with variables name and value.
After that you can put them in a payload variable object or array.
Finally, you can send the PUT request with payload like a variable.

Regarding the second variable. Let us take a look to value.
It is a string of a table which contains two objects.


    “[
        {
            “engine_model”:“LiftSystem”,
            “pub_number”:“60003”,
            “pub_type”:“HMM”,
            “dmc_task_chap”:“PWF135-SAA-78-60-C300-00AA-310A-C”,
            “doc_priority”:
                {“id”:null,
                “name”:“Routine”
                },
            “revision”:“001”,
            “summary”:”“}
    ]”

Here is an approach to deal with that:
//1. Change each property object with variables
//2. Generate a variable that store your object.
//Repeat
//3. push it in a table
//4. Stringify
Below find a pre-request

And here the request and the body:

I also generate a collection based on your post .Whether you want to invite me in one of your collection, feel free to message me.

This will be down to what the API accepts.

JSON is key\value pairs. The value can be a another object, a string, or an array.

For your “value” key. You currently have an object, wrapped in an array, wrapped in a string.

The entire request is also an object in an array.

You are currently getting an JSON parse error, and I’m guessing its because of the “value” details.

Usually, you wouldn’t see the array wrapped in a string, so that would be the first thing I would try, however I have seen JSON they do wrap arrays in a string on purpose (although I wish they wouldn’t). As you then need to PARSE and stringify it when working with those elements.

Comes back to the instructions for the API. Is there documentation you can share to check how multi line requests are submitted.