JSON Parse error Source is not valid JSON

What are you trying to achieve?

I am building an automation in Make.com where I use the OpenAI GPT (gpt-4o or gpt-3.5-turbo) module to generate a LinkedIn post in JSON format. The structure includes fields like Title, Content, and hashtags.
I want to parse this JSON response using the JSON module in Make, but I consistently encounter the following error:
“DataError: Source is not valid JSON”
This happens even though the GPT output looks like valid JSON, for example: {
“Title”: “Boost your professional profile with LinkedIn marketing strategies”,
“Hashtags”: [“linkedin”, “#Marketing”, “#DigitalStrategy”],
“Content”: “Learn how to elevate your LinkedIn game with proven marketing strategies designed to enhance your professional brand. Join us for an exclusive webinar on boosting your visibility and engagement on LinkedIn. Don’t miss out on this opportunity to leverage the power of LinkedIn for career growth!”,
“Link”: “https://www.linkedin.com/webinar-linkedin-marketing-strategies
}
ChatGPT want me to to insert extra tools like Set variable. Is it the right way?

Steps taken so far

Changing GPT 4o to 3.5 Turbo, different User Prompt in OpenAI module, different JSON string.

Screenshots: scenario setup, module configuration, errors


blueprint.json (185.9 KB)

1 Like

Hi Adelina_Arendarska The error I’m seing is that you are not calling the data in the right way. Use this text {{9.choices[0].message.content}} in the ParseJSON module instead, you will see that is different than a normal text and delete the setvariable module


2 Likes

Hi @Adelina_Arendarska,

To resolve the “DataError: Source is not valid JSON” issue, you need to make sure the JSON generated by the GPT module is strictly valid, without any extra content or formatting issues.

Solution:

Step 1. Add a note in the prompt:
NOTE: The output result should be strictly in JSON without any additional content, and it should return the output in the following structure:
{
“Title”: " “,
“Hashtags”: [” "],
“Content”: " ",
“Link”: " "
}

Step 2. Parse the JSON structure:

Add Sample Data and click Generate

Then Map the Chat GPT result (i.e., JSON output) correctly

Let me know if you’d like further assistance.

If this helps, please consider marking it as the solution :blush:

2 Likes

It Stil doesn’t work…





openAI User promot: Based on the input, generate a LinkedIn post structure as valid JSON.

Important:

  • Return only valid JSON.
  • Do not include any explanations, markdown, or text outside the JSON.
  • The response should start and end with curly brackets {}.

Example format:
{
“Title”: “”,
“Hashtags”: [“”],
“Content”: “”,
“Link”: “”
}
Only respond with valid JSON. Do not add any explanation or text outside of the JSON object.
If you add anything else, it will break the automation.
NOTE: The output result should be strictly in JSON without any additional content, and it should return the output in the following structure:
{
“Title”: " “,
“Hashtags”: [” "],
“Content”: " ",
“Link”: " "
}

Now generate JSON based on this input:
{{7.choices[0].message.content}}

BundleValidationError

Validation failed for 1 parameter(s).

  • Missing value of required parameter ‘json’.

Output

  • Bundle 1Collection

    • Result

{ “Title”: “Boost Your LinkedIn Marketing Strategy with These Top Tips!”, “Hashtags”: [“LinkedInMarketing”, “DigitalMarketing”, “SocialMediaTips”], “Content”: “Are you looking to enhance your LinkedIn marketing game? Check out these top tips to elevate your strategy and connect with your audience effectively!”, “Link”: “https://www.linkedin.com/marketing-tips” }


" * GPT may return valid JSON as a string or an object, depending on:

  • Model version (e.g. gpt-3.5-turbo vs gpt-4o)
  • Slight differences in how you word your prompt
  • Hidden Make behaviors (how it treats message.content internally)

That’s why it works “sometimes” without help — and sometimes fails, even if the JSON looks perfect." Is that really true???

It dosn’t work even if I choose the dynamic value :frowning:

1 Like

Adelina_Arendarska Make sure you are using Straight Quotes " instead of Curly Quotes
You can check if your JSON is valid here https://jsonlint.com/

1 Like

Everything has been checked :white_check_mark: but nothing seems to be the solution.

Hey Adelina,

can you show us the configuration of the Chat GPT module before the parse JSON one? Did you toggle the setting for it to return a JSON or just asked for one in the prompt?

2 Likes

I I deleted that module and shortened my automation because none of the dozen suggested solutions worked.

Thank you for your help!

2 Likes