What is the correct JSON formating with variables on Make?

Hello,

I have a weird situation.

When I run JSON body with values from previous modules it returns me an invalid JSON error:

Screenshot 2024-04-04 at 15.08.34

However, if I take the same output from a module that just errored out and put it into another API call module it works:

That being said am I misusing values from previous modules? Is there a correct way to use them?

You can validate your input JSON using https://jsonformatter.org, which is also what I use.

If you need further assistance, please provide the following:

Please provide the input bundles of the module by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.
Screenshot_2023-10-06_141025

A.

Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

Uploading them here will look like this:

module-1-input-bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

Providing the input/output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

This will allow others to better assist you. Thanks!

2 Likes

So this is an input bundle:

[
    {
        "url": "/v3/contacts",
        "body": "{ \n\"pipedrive_person_id\": \"280370\",\n\"full_name\": \"Chris Justas\",  \n\"phone\": \"\",   \n\"email\": \"justas@eskimi.com\",  \n\"job_title\": \"Data Scientist\",\n\"company\": \"Dayta Designs\",\n\"contact_type\": \"contact\",\n\"dsp_company_id\": \"230\",\n\"country_name\": \"United Kingdom\",\n\"tier\": \"\",\n\"sales_name\": \"Benin Thomas\",\n\"icp\": \"Media agency\",\n\"createddate\": \"2024-04-04\"\n}",
        "method": "POST",
        "headers": [
            {
                "key": "Content-Type",
                "value": "application/json"
            }
        ]
    }
]

And this is what I get in an output bundle:

[
    null
]

However, as I mentioned if I just copy the body portion from this screenshot and create the exact same API call it suddenly works. However, I want to achieve this with values from previous modules and not just with static values.

Have you tried to compress json string? Remove all the spaces and newlines, sounds stupid but i was getting errors in some of the api calls because of stray \t and trailing spaces.
Also compare formed request payloads with use of integromat DevTool, because input bundle is processed to make request and they may be different.

2 Likes