Cannot parse data of postman webhook

I have a postman webhook setup but I’m having a problem parsing the data. I am accessing the request body exactly as outlined in documentation…

var previousRequest = JSON.parse(globals.previousRequest),
    webhookRequestData = previousRequest.data;

The problem is webhookRequestData is not valid json and I am unable to access any of the information.

Here is an example response:

{  '{"fcResponse":{"responseData":{"cmContact":{"ownerType":"Franchisee","country":"USA","_pickYourDesiredAppointmentDate583732175":"","contactFirstName":"Samantha","_vehicleserviceinterest1497622543":"Vehicle Wraps Graphics","_commercial1827422581":"","contactType":"Retail Customers","_vehicleEngine1759783270":"","_buildingType363061559":"","suffix":"","_ifThisIsRegardingASpecificServiceYouReceivedWhenDidT1573731334":"","areaID":"","unsubscribe":"Opted In","cmLeadStatusID":"New","state":"","_enterYourDesiredAppointmentTime853588546":"","contactAddedBy":"Web SERVICE","emailIds":"notreal@gmail.com","areaReferenceId":"","bounceEmailStatus":"No","_dynamicCoupon188185671":"","cmSource3ID":"TintWorld.com Quote Request","_emailSignUp1344452027":"Yes","_recommendedButDeclined27767687":"","cmSource1ID":"","_formType1540301458":"quote","_vesselType1902339993":"","zipcode":"","smsUnsubscribeDate":"","franchiseeReferenceId":"513159907","contactedBySmartScheduler":"","_vehicleSubmodel1467066024":"","lastContactedField":"","contactAddDate":"2024-01-26T18:47Z","contactLastName":"Nott","divisionID":"","position":"","smartSchedulerAppointmentDate":"","_vehicleMake139916510":"Ford","_vehicleYear1213765475":"2019","_vehicleModel427539974":"Mustang","extn":"","city":"","_marine368878106":"","contactAddedByReferenceId":"2","spamEmailStatus":"No","referenceId":"673780370","phoneNumbers":"1234567890","_automotive2043077692":"Vehicle Wraps Graphics","faxNumbers":"","tenantID":"TintWorld92","respondedToSmartScheduler":"","bounceReason":"","smsUnsubscribe":"Opt-In Request not Sent","unsubscribeDate":"","_homeType32064006":"","franchiseeNo":"TN - Memphis - Store076","alternateEmail":"","comments":"2019 mustang eco boost color black Looking to wrap a metallic teal color","address":"","cmSource2ID":"Internet","mobileNumbers":"","_residential648719965":"","_syncid1307531401":"","contactModifyDate":"","unsubscribeReason":"","contactOwnerReferenceId":"1705095989","cmLeadSubStatusID":"","_vehicleDoors1043267202":"2","contactOwnerID":"Tint World Store 076 Manager","accountDetails":{"emailIds":"","accountName":"","accountType":"","companyAddDate":"","referenceId":""},"unsubscribeReasonDetail":"","divisionReferenceId":"","serviceID":"Email Communications, Information Email","_requestType2131132030":"","_mileageIn633847082":""}},"responseStatus":"Success","responseId":"1050617154"}}': ''}

If I delete the outer curly braces along with the extra characters it would be valid json. I tried converting to a string to strip the extra characters and reparsing but was never able to get it to work. Has anyone else run into this issue before? Any help is appreciated.

Hey @msewell13 :wave:

Welcome to the Postman community :postman:

Which documentation are you following? Do you have a link to that?

If its from this:

var previousRequest = JSON.parse(globals.previousRequest),
    webhookRequestData = previousRequest.data;

// webhookRequestData contains the data sent to your webhook.
console.log(JSON.stringify(webhookRequestData)); 

Are you using JSON.stringify() with your response?

Thanks for responding. Yes, that is the documentation I was referring too. I did not however use the JSON.stringify().

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.