Receiving data from the web form as JSON including attached files

Hi MAKErs,

I am trying to figure out how to process files/attachments received from a web form into MAKE via Webhook.
I need to identify a file that eventually will be saved to the Google drive.
I have a problem allocating a physical file I get from the web form in JSON format. Here is an example of the JSON I get:
Thanks in advance.

[
{
“type”: “complain”,
“language”: “English”,
“productType”: “Cigarettes & Cigarillos”,
“brand”: “PARLIAMENT”,
“affectedQuantity”: “12”,
“serialCode”: “TZYG7KTXBJLVH5”,
“affectedUnit”: “PACK(S)”,
“serialCodePictures”: [
{
“name”: “PMI logo2.jpg”,
“data”: "data:image/jpeg;base64,/9j/4QUdRXhpZgAATU0A… etc very long file encoding

}
],
“issueMessage”: " Spots on the cigarette rod",
“purchaseDate”: “04-02-2025”,
“purchasePrice”: “12.44”,
“purchaseCurrency”: “CAD”,
“defectNoticed”: “20-02-2025”,
“storeLocation”: “dsgdfgdfg”,
“isAnonymous”: true,
“fistName”: “”,
“lastName”: “”,
“email”: “”,
“phone”: “”,
“address”: “”,
“city”: “”,
“zipCode”: “”,
“dateOfBirth”: “”,
“priority”: “High”,
“countryCode”: “DE”,
“purchaseReceipt”: ,
“state”: “”,
“months”: “September”,
“years”: “1988”
}
]

I manage to save a file to the Google Drive, but I can’t open it.

Welcome to the Make community!

You can use the built-in functions replace and toBinary

e.g.:

{{ toBinary(replace(1.data; "data:image/jpeg;base64,"; emptystring); "base64") }}

Screenshot_2025-02-27_130230

For more information, see the replace and toBinary function documentation in the Help Center and do the tutorials in the Make Academy.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

2 Likes

Thanks a lot @samliew . This was exactly what I needed.

1 Like