A common use case for the JSON List Processor is to process API requests containing lists with a dynamic number of items. For example, if you sent the following request:
{
"request": {
"items": [
{ "id": 1, "name": "William" },
{ "id": 2, "name": "Beverly" },
{ "id": 3, "name": "Richard" }
]
}
} |
You might want to see the following response:
{
"response" : {
"itemResponses" : [
{ "id": 1, "name": "William", "balance" : 72500.13 },
{ "id": 2, "name": "Beverly", "balance" : 33000.99 },
{ "id": 3, "name": "Richard", "balance" : 42010.75 }
]
}
} |
You can accomplish this with the JSON List Processor. The following workflow demonstrates how:
Create a new .pva and add a JSON Responder to the suite.

{
"response" : {
"itemResponses" : [
${Outgoing List}
]
}
} |
${Outgoing List} variable will be resolved at runtime with the aggregated responses for each item processed by the JSON List Processor.


import com.parasoft.api.Application
def showMessage(input, context) {
Application.showMessage("Extension Tool Output - Incoming Item:\n" + input + "\n") |
| id | name | balance |
|---|---|---|
| 1 | William | 72500.13 |
| 2 | Beverly | 33000.99 |
| 3 | Richard | 42010.75 |

{
"id": 1,
"name": "William"
} |

id field and use the data source column “id”.
{
"id" : ${id},
"name" : "${name}",
"balance" : ${balance}
} |

There are a couple ways you can choose to handle errors in your .pva. Add either (or both) of these to the responder suite you built above:
Option 1: Return a Custom Error Message for Invalid Items
If an item’s id does not exist in the data source, you may want to return a custom error message for that item.
{
"id" : “${{=/root/id/text()}}”,
"error" : {
"code" : "NOT_FOUND",
"message" : "No active account found for id '${{=/root/id/text()}}'."
}
} |
This payload uses inline expressions to extract values from the incoming JSON directly. Alternatively, you could use a JSON Data Bank to extract values.
{
"request": {
"items": [
{ "id": 1, "name": "William" },
{ "id": 13, "name": "George" },
{ "id": 2, "name": "Beverly" },
{ "id": 3, "name": "Richard" }
]
} |
Option 2: Ignore Invalid Items So They Are Not Aggregated
If you prefer to exclude invalid items from the outgoing list, configure the error responder with an empty response. This instructs the JSON List Processor to omit those items from aggregation.