Skip to main content
Best answer

All Keys from an object

  • December 4, 2020
  • 1 reply
  • 222 views

andywingrave
Forum|alt.badge.img+9

Hello! Wondering if anyone can help me figure something out - Is it possible to get the whole returned object data and pass that through to a step?

So instead of just returning a specific key - return the whole object and pass that through to another step as a variable?

I’ve tried every variation of {{object__allkeys}} that I can think of

Best answer by andywingraveBest answer by andywingrave

Answering this, as I found the answer out by doing a lot of troubleshooting. In effect, you can get all child keys by using a code step and parsing the stringified JSON. Here’s the code step I used for future reference: 

 

const store = StoreClient(inputData.secret);
const email = inputData.email
const test = await store.get('trello-sync')
var trelloID = JSON.parse(JSON.stringify(test))[email]
return {trelloID} // value === 'world'

 

View original
Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

andywingrave
Forum|alt.badge.img+9
  • Author
  • Zapier Expert
  • 854 replies
  • Answer
  • December 6, 2020

Answering this, as I found the answer out by doing a lot of troubleshooting. In effect, you can get all child keys by using a code step and parsing the stringified JSON. Here’s the code step I used for future reference: 

 

const store = StoreClient(inputData.secret);
const email = inputData.email
const test = await store.get('trello-sync')
var trelloID = JSON.parse(JSON.stringify(test))[email]
return {trelloID} // value === 'world'