JSON Parser drives me crazy

Hi,

JSON Parsers is driving me crazy. I don’t understand why.
So I have this workflow to create optimized blog posts and 90% of the times when I run the scenario, the JSON Parser modules fail, 10% they work just fine.

What I have at the end of the first ChatGPT:

OUTPUT FORMAT
The output should be provided in the following JSON format:

{
“title”: “”,
“description”: “”,
“seo_description”: “”,
“content”: “”
}

What I have at the end of the second ChatGPT:

OUTPUT FORMAT
The output should be provided in the following JSON format:

{
“optimized_title”: “”,
“optimized_description”: “”,
“optimized_seo_description”: “”,
“optimized_content”: “”,
“custom_url”: “”,
“feedback”: “”
}

The error I am getting (attached)



)

What am I doing wrong?
Would it be better to ask ChatGPT to output in JSON, instead of TEXT?
If I do that, I cannot ask it to check its knowledge base to retrieve knowledge though.

EDIT: A new problem arose.Now it seems that the JSON works 90% of the time, although it fails 10% of the time, but when writing on the Google DOC, it says:

[400] Invalid value at 'requests[8].replace_all_text' (replace_text), Starting an object on a scalar field

Thanks for the help and support!

Definitely more reliable to have openai out the value as structured data.

I would check multiple input bundles that give you errors and put them through a format checker. See if you can determine what the actual issue is and if there is a way you can prevent it through better prompts.

Please provide a full screenshot of the Output bundle, it is cropped off in the second screenshot above.

For further assistance, please provide the following:

1. Screenshots of module fields and filters, and any error messages

Please share screenshots of relevant error messages, module fields, and filters in question? It would really help other community members to see what you’re looking at.

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

2. Scenario blueprint

Please export the scenario blueprint file to allow others to view the mapped variables in the module fields. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.

3. And most importantly, Input/Output bundles

Please provide the output bundles of the modules 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”.

A.

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

B.

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

Here are two ways to format text so that it won’t be changed by the forum:

A. Type code block manually
Add three backticks ``` before and after the content/bundle, like this:

```
content goes here
```

B. 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 even if they do not use the external service.

Following these steps will allow others to assist you here. Thanks!

What do you mean? Can you explain?

It is giving me error on the second JSON.
What is wrong? It seems so similar to the first one.

w

blueprint.json (120.4 KB)

Here is the blueprint

I made some extra changes, splitting things and I am still getting an error. As example, here is the output of a chatgpt:

{
  "feedback": "### Introduction & Emotional Hook\nThe introduction effectively presents the excitement of the partnership between BlackCube Labs and EffiTrack. However, it could benefit from a more emotional or narrative-driven hook to capture the reader's attention immediately. Consider starting with a relatable scenario that illustrates the common struggles of startups. For example, 'Picture a small startup founder in a bustling co-working space, overwhelmed by spreadsheets and deadlines—this is where our partnership aims to make a difference.' This approach helps to establish a connection and draw readers in.\n\n### Consistency\nThe tone and language used throughout the piece are fairly consistent with a branded, professional voice appropriate for the audience. Ensure that this tone is maintained even in the quotes from the CEOs. While they express enthusiasm, the language used could be moderated slightly to fit more fluidly with the surrounding content.\n\n### SEO & Keywords\nThe keywords provided, such as \"AI-driven operational efficiency\" and \"generative AI solutions,\" are present; however, they could be more strategically integrated into subheadings and throughout the article. For optimal SEO performance, aim to use these keywords naturally in headings where they fit contextually. Additionally, consider adding links to authoritative sources or other relevant pages on both BlackCube Labs and EffiTrack websites to improve backlinking.\n\n### Flow\nThe blog post flows logically from the introduction, through the explanation of the partnership’s implications, to the conclusion. Each section transitions smoothly into the next. However, the list of benefits for entrepreneurs could use an introductory sentence to prepare the reader for this section, ensuring it reads more seamlessly.\n\n### Depth & Detail\nThe content does provide some depth regarding the partnership and its benefits. More specific examples or case studies of potential outcomes could enrich this section. Also, consider discussing specific challenges entrepreneurs face that the partnership seeks to address more explicitly, such as time management or financial strain during startup scaling.\n\n### Quotes & References\nQuotes from Marta Marrucco and Andrea Marchiotto are insightful and effectively lend credibility and authority to the post. However, introducing these quotes with more context about their expertise or their company’s specific goals can enhance their impact. Add attributions that explain why their opinions are particularly valuable.\n\n### Grammar & Readability\nThe grammar is generally strong, with only minor adjustments needed for clarity. For example, phrases like \"Together with BlackCube Labs\" could be restructured for better flow, such as \"In conjunction with BlackCube Labs...\". Additionally, the use of bullet points enhances readability, but consider breaking longer paragraphs into smaller ones to maintain reader engagement and make the information more digestible.\n\nLastly, be mindful of using some passive constructions, as these can dilute the impact of the writing. Active voice tends to be more powerful and engaging for readers."
}

and here is the result on the following module:

Updated blueprint attached:
blueprint_v2.json (105.7 KB)

See Issue with JSON Parsing in OpenAI Response - #2 by samliew

1 Like

Something is off and I think it is actually now how ChatGPT spits the output. See:



![Screenshot 2024-09-27 at 15.34.58|564x500](upload://wC313n5ZIxTeTRPUp56J9YnFQGh.png
d

You’ll have to refine your prompt further so that the output format is more consistent then.

Or use two separate modules instead - one to generate content, and one to convert to JSON.

Like with this one?