Skip to main content
Participating Frequently
October 14, 2025
Solved

How to use Output Mapper for API response with root array?

  • October 14, 2025
  • 5 replies
  • 91 views

I am able to get a JSON object root response to work, like this:
 

{    
"Items": [
{
"name": "root?",
"thing2": "asdf"
},
{
"name": "root 2?",
"thing2": "asasdfasddf"
}
]
}

With Mapper like this:

output:
MAP():
items: Items
converter:
name_output: item.name

Output is this (as expected):

{
"output": [
{
"name_output": "root?"
},
{
"name_output": "root 2?"
}
]
}

 

 

Problem is when the input (response object) is an array of objects with no root key to address:

[
{
"name": "root?",
"thing2": "asdf"
},
{
"name": "root 2?",
"thing2": "asasdfasddf"
}
]

What would be the equivalent Mapper to use to get the same output as above?

This topic has been closed for replies.
Best answer by Kevin Mok

Hi ​@an unique usernameYour first implementation is incorrect, and it should not be working. You need to use the response identifier to let the platform know that you are accessing the response of the action, like this:

output:
MAP():
items: response.Items
converter:
name_output: item.name

In the case where there isn’t a top level key, then you would do:

output:
MAP():
items: response
converter:
name_output: item.name

 

5 replies

Participating Frequently
October 15, 2025

@JenHanley I intended to post this to Agent Studio section.   Can you move me to the appropriate place?

Thanks!

JenHanley
Community Manager
October 15, 2025

Absolutely! Done ​@an unique username 

Kevin Mok
Kevin MokAnswer
Community Manager
October 16, 2025

Hi ​@an unique usernameYour first implementation is incorrect, and it should not be working. You need to use the response identifier to let the platform know that you are accessing the response of the action, like this:

output:
MAP():
items: response.Items
converter:
name_output: item.name

In the case where there isn’t a top level key, then you would do:

output:
MAP():
items: response
converter:
name_output: item.name

 

Participating Frequently
October 23, 2025

Thank you ​@Kevin Mok, that answers my question and works as expected for me.     

Kevin Mok
Community Manager
October 23, 2025

Glad it works now!