Skip to main content
Best answer

Extracting information from Flattened JSON

  • August 17, 2022
  • 5 replies
  • 995 views

I am trying to extract information from a webhook - but the JSON is flattened. Not sure how to send the email ID and tracking link to Sendgrid

 

It sends a Raw Body with Multiple IDs for example

 

{"start_datetime":"2022-08-19T13:30:00.000Z","end_datetime":"2022-09-03T13:45:00.000Z","name":"XXXXX","country_code":"XXX","phone_number":XXXX,"job_id":58014,"email":"Email1",""job_status":”www.test.test”,"email2":”email2@email2.com,

 

I want to send Email2 and job_status to sendgrid to trigger an email

Best answer by RussMcGill

If you just use a catch hook instead of a raw catch hook, the data will come in already parsed and it’s much easier to work with if you don’t know how to parse it manually!

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

5 replies

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • August 17, 2022

Hi @ychahien 

Good question.

Check out this related topic:

 


  • Author
  • New
  • August 17, 2022

Thank you @Troy Tessalone 

Not sure if this answers my questions. Apologies for my blindess here - but i’m new. Can you guide me on exactly how i need to set up my Zaps? 

 

I have this response from a Catch Raw Hook. 

 

{"start_datetime":"2022-08-19T13:30:00.000Z","end_datetime":"2022-09-03T13:45:00.000Z","name":"ABCD","country_code":"+ABCD","phone_number":ABCD,"job_id":58014,"email":"yABCD","user_image":null,"job_status":1,"event_id":3,"event":"ASSIGNED","template":[{"name":"ABCD","value":""},{"name":"DeliveryTime","value":""},{"name":"ShipmentType","value":""},{"name":"ABCD","value":""},{"name":"DeliveryInstructions","value":""},{"name":"ABCD","value":""},{"name":"Additional Email ID","value":"EMAILINEED@ABCD.COM"}],"task_details":{"cust_name":null,"task_name":"ZappierTestOrder","task_type":0,"task_description":"Zappier Test","user_id":1493,"country_code":"+ABCD","task_id":ABCD,"phone":"ABCD","email":"yABCD","location":"The Dubai Mall - Dubai - United Arab Emirates","reference_id":"ABCD","job_id":ABCD,"timezone_string":"Asia/Dubai","end_datetime":null,"resource_id":1495,"task_arrival_map":null,"lat":"ABCD","lng":"ABCD","local_datetime":"2022-08-19T17:30ABCD00.000Z","route_id":null,"otp":null},"secret_key":"ABCD","tracking_link":"URL I NEED","otp":"---","eta":"---","resource_name":"Yousef ABCD","resource_number":"+ABCD","customer_email":"ABCD@ABCD.com","customer_name":"ZappierTestOrder","address":"The Dubai Mall - Dubai - United Arab Emirates","job_time":"19-08-2022 05:30 PM","start_time":"19-08-2022 05:30 PM","end_time":"Invalid date","description":"Zappier Test","template_fields":"[{\"name\":\"ShippinABCDgMode\",\"value\":\"\"},{\"name\":\"DeliveryTime\",\"value\":\"\"},{\"name\":\"ShipmentType\",\"value\":\"\"},{\"name\":\"ABCD\",\"value\":\"\"},{\"name\":\"DeliveryInstructions\",\"value\":\"\"},{\"name\":\"ItemsToPickUp\",\"value\":\"\"},{\"name\":\"ABCD Email ID\",\"value\":\"ABCD@gmail.com\"}]","start_date":"19-08-2022 05:30 PM","end_date":"03-09-2022 05:45 PM","reference_id":"PickupOrder","eta_time":"---","route_arrival_time":"---"}

 

WHAT I NEED: 

I Need to send an email to the email mentioned on “Additional Email ID” with the content under “Tracking_Link”

 

Sorry for my stupidity here but im completely lost. 


RussMcGill
Forum|alt.badge.img
  • New
  • Answer
  • August 17, 2022

If you just use a catch hook instead of a raw catch hook, the data will come in already parsed and it’s much easier to work with if you don’t know how to parse it manually!


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • August 17, 2022

@ychahien 

You can also use multiple Formatter > Text > Split steps to isolate the desired variables.

 

###

 

Did you review the provided reference topic for using JavaScript code to parse data points using the .split() function?

 

Using Code steps in Zaps is an advanced approach, so perhaps consider hiring a Zapier Expert for help: https://zapier.com/experts

 

 


  • Author
  • New
  • August 17, 2022

Thank you