Question

Pick off a Child Key Syntax

  • 10 June 2022
  • 8 replies
  • 829 views

I an trying to use Pick off a Child Key but when I use the syntax as below it doesn’t work:

This is a subset of the payload

data[contact]

{:id=>"61d8326f88d0cd60e710e5e7", :first_name=>"TEST FIRST NAME AAABB", :last_name=>"TEST LAST NAME", 

and I an adding “contact” as the key


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

8 replies

Userlevel 7
Badge +14

Hi @AgriZap 

Good question.

Can you post screenshots with the format of the full data payload received by the Zap trigger?

 

Userlevel 7
Badge +14

@AgriZap 

Have you tried: data[contact]

Yes - with the same result

 

Userlevel 7
Badge +14

@AgriZap 

You may need a Code step as Step 2 in the Zap to convert the JSON for data[contact].

 

EXAMPLE

INPUT + CODE

 

OUTPUT

 

If I do above for a RAW hook I am required to pick from the fields available in the right hand box of Input Data - so when I do that I get this

Failed to create a run javascript in Code by Zapier

SyntaxError: Unexpected token y in JSON at position 1

 

 

This is the code

let Contact = JSON.parse(inputData.RAW); output = [{Contact}];

 

If I do it for a Catch Hook I also have to do this and choose the Contact field - I also get the same error

I actually got it to work - I had to change the format of the First Zap Webhook step

Userlevel 7
Badge +9

Hey @AgriZap so glad to hear this! Are you able to elaborate on the format change you made to help others that may be experiencing a similar issue? Let us know!