@pikorpa pointed out SpecificContent
is Dictionary(Of String, Object), so if you want to add a more complex JSON object that contains Arrays / Objects, you must first serialize the JSON.
{
"itemData": {
"Name": "asdf",
"Priority": "High",
"Reference": "{{$guid}}",
"SpecificContent": {
"Test" : {{specific_content}}
}
}
}
In the above specific_content
is the value string of the following (Using Postman)
const TestData= [{
"seq": 1,
"loc": {"address": {"city": "ABC", "state": "XX", "zip": "1234"}}
},
{
"seq": 99,
"loc": {"address": {"city": "YYYY", "state": "AR", "zip": "54321"}
},
"comments": [
{"type": "Test Comment Data", "value": "comment 1"},
{"type": "Test Comment Data 2", "value": "comment 2"}
]
}]
pm.environment.set("specific_content", JSON.stringify(JSON.stringify(TestData)));
which results in specific_content
with the string value of "[{\"seq\":1,\"loc\":{\"address\":{\"city\":\"ABC\",\"state\":\"XX\",\"zip\":\"1234\"}}},{\"seq\":99,\"loc\":{\"address\":{\"city\":\"YYYY\",\"state\":\"AR\",\"zip\":\"54321\"}},\"comments\":[{\"type\":\"Test Comment Data\",\"value\":\"comment 1\"},{\"type\":\"Test Comment Data 2\",\"value\":\"comment 2\"}]}]"
You would then have to deserialize the JSON string in “Test” value when you fetch the queue item.