Solved - Error: We could not parse the JSON body of your request

Continuing the discussion from Get does not appear to be in valid JSON format. Please ensure your file is formatted as a valid JSON file. every time:

This is the JSON payload I pass to api.openai.com/v1/chat/completions:
{
“model”: “gpt-3.5-turbo”,
“messages”: [
{
“role”: “system”,
“content”: “You are a poetic assistant, skilled in explaining complex programming concepts with creative flair.”
},
{
“role”: “user”
,“content”:“Compose a poem that explains the concept of recursion in programming.”
}
]
}

I get this error in the reponse:
We could not parse the JSON body of your request

It was the example taken right from the quick start page for curl.

Is this JSONL a thing for 3.5 turbo?

The api call happens in Oracle PLSQL, so the JSON is passed as a string.

Any help would be appreciated on this error.If you think the JSONL thing is the issue, please let me know. If not, let me know as well. Any insight helps clear the path with the fewest rabbit holes lol.

Is it the exact copy of the payload? Because the quotes don’t seem to be correct.
What you have: ”
Should be: "

Not sure why they came out that way here. They’re definitely straight up and down double ticks:
“model”

ok - in the editor they show correct, but in the post they show angled lol

1 Like

I write the endpoint and json payload to the web page for testing. Here’s a screenshot of a view source of the web page.

It turns out I was a bit too exacting in using the example. The only headers they add are Content-Type and Authorization. I added Content-Length and passed the JSON error. Now I’m getting a rate limit error.

Step 1 is now passed. I’m now talking to the API

1 Like