How to return a json object from a webhook?

I have a very simple flow.

I create a google doc upon webhook activation. I want to return the ID in json.

What gets returned is a STRING inside an ARRAY.

not a json.

Actual return value:

[

{

“data”: “{\n “document_id”: “1E3nVm5Y-RyQvfZw4pbxzVFzqM1jAOg24rzN_HSpQ9Dg”,\n “something_else”: “For john doe: Personalized Newsletter”\n}”

}

]

I would love to share the workflow for everyone to see but not sure how to properly ask questions here.

Thanks

Hi Noam, if you want to return a JSON like this:


You have to go to the create JSON module and edit the specification


Delete the current specification

add this one (or the one you need)

{
“data”: {
“document_id”: “IDasdkjqwkej”,
“something_else”: “something else”
}
}

Paste the data and click on generate


Map the document data that you need on “document_id” and “something_else”

And lastly, add an item on custom headers on the webhook response. On key put content-type and on value application/json

That will return a JSON as a response

If you want to save an operation you can delete the “create JSON” module and add the string directly to the body of the webhook response and map the document data there
As long as it is a valid JSON string it will work

I hope this was helpful

Hi, thanks

This doesn’t work.

What this returns is a stringified json and not an actual json, which was my question.

You can see I actually did the exact same thing in my question.

Do you want to use the JSON directly on make?

Welcome to the Make community!

This is because your Data Structure may be incorrect. Could you provide a screenshot of how your JSON module and Data Structure is set up?

You have not yet provided sufficient information to demonstrate the problem that would allow us to reproduce the scenario and any error(s).

To allow others to assist you with your scenario, please provide the following:

1. Relevant Screenshots

Could you please share screenshots of your full scenario? Also include screenshots of any error messages, module settings (fields), relevant filter settings (conditions), and module output bundles. We need to see what you’re working with to give you the best advice.

You can upload images here using the Upload icon in the text editor:

We would appreciate it if you could upload screenshots here instead of linking to them outside of the forum. This allows us to zoom in on the image when clicked, and prevent tracking cookies from third-party websites.

2. Scenario Blueprint

Please export the scenario blueprint. Providing your scenario blueprint file will allow others to quickly recreate and see how you have set up the mappings in each module, and also allows us take screenshots or provide module exports of any solutions we have for you in return - this would greatly benefit you in implementing our suggestions as you can simply paste module exports back into your scenario editor!

To export your scenario blueprint, click the three dots at the bottom of the editor then choose ‘Export Blueprint’.

You can upload the file here by clicking on this button:

3. Output Bundles of Modules

Please provide the output bundles of each of the relevant modules by running the scenario (you can also get this without re-running your scenario from the History tab).

Click on the white speech bubbles on the top-right of each module and select “Download input/output bundles”.

A. Upload as a Text File

Save each bundle contents in a plain text editor (without formatting) as a bundle.txt file.

You can upload the file here by clicking on this button:

B. Insert as Formatted Code Block

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles.
These are the two ways to format text so that it won’t be modified by the forum:

  • Method 1: Type code block manually

    Add three backticks ``` before and after the content/bundle, like this:

    ```
    content goes here
    ```

  • Method 2. Highlight and click the format button in the editor

Providing the input/output bundles will allow others to replicate what is going on in the scenario, especially if there are complex data structures (nested arrays and collections) or if external services are involved, and help you with mapping the raw property names from collections.

Sharing these details will make it easier for others to assist you.