Parsing JSON from Claude API Output - Error

Hey guys I’m trying to parse a JSON output from Claude API and I suspect because of the typographical and punctuation symbols within its output, it’s disrupting the JSON structure and therefore my next module which is ‘parse JSON’ keeps saying that ‘source is not valid JSON’. Is there any work around I can use for this or any smart strategies. Please see pic attach

ed

Hello @Strm,

If your AI model output format is always the same and validated then this error has not come.

This is a very common error that occurs with most users who don’t know more about how the prompt, json and any of the AI module settings work.

Just keep in mind that whatever AI Model you’re using it always needs 3 things in the prompt.
Input( Explain to them the background and whether this is my sample data or actual data).
Process ( What is the process you need to do on that data? Like transform, translate, combine etc)
Output (In a prompt also tell them that this is my sample output and I also want that generated output will be given in this specific format).

Also, read my given answer on this topic. Not the same but at least you can understand the concern that I’m trying to explain.

Other useful information.

First of all, don’t be confused.
Just go https://www.make.com/en/help/app/openai-dall-e-chatgpt
Check each option and read about it.

Also, check this on that same page Create a Completion (Prompt) (GPT and o1 Models)
There are options like Response Format which works alongside prompts.

Best tip

Based on all the things ask GPT UI to generate a prompt for you. But be sure about your Input, Process and Output.

I hope this gives you more confidence to solve things.

Updated: Added reference post specific to this topic A Beginner's Guide to Effective AI Prompts: The Input-Process-Output Framework


:bulb:P.S.: Always search first, Check Make Academy. If this is helpful, Mark Best Answers as Solutions :white_check_mark: and give :+1: If you need expert help or have questions? Contact or comment below! :point_down:

Yup, that’s definitely invalid JSON because there are newlines in the post strings.

I guess you’ll have to use a smarter AI model, improve your prompt, or switch to another AI service that can output correct JSON directly like OpenAI or Groq.

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.

1 Like