Getting Value of JSON with random key

Hi!

I have an http request node which returns a json with the following structure

[

{

"RANDOM_KEY": {

"name": "AAAAAAA" ,

"value": "1111" 
}

}

]

And I am connecting the http request node to a set node where I need to grab the "name" value from the http request node. The problem is that as the RANDOM_KEY value changes with every run I am not getting the value I need.

Any ideas how can I achieve this?
Thanks in advance!

Welcome to the community @yakito

Add a function node after the HTTP node, with the following code:

const data = items[0].json

const key = Object.keys(data)[0]

return [
  {
    json: data[key]
  }
]
Example workflow
1 Like

Thanks a lot! that was it! @RicardoE105

Great that it worked. Have fun.

2 Likes