Skip to main content
Solved

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

  • October 14, 2025
  • 5 replies
  • 47 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?

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

  • Author
  • 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
Forum|alt.badge.img+1
  • Community Manager
  • October 15, 2025

Absolutely! Done ​@an unique username 


Kevin Mok
Forum|alt.badge.img+1
  • Community Manager
  • Answer
  • 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

 


  • Author
  • Participating Frequently
  • October 23, 2025

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


Kevin Mok
Forum|alt.badge.img+1
  • Community Manager
  • October 23, 2025

Glad it works now!