ChatGPT includes comments in JSON request to plugin

During plugin development, I found odd behavior by ChatGPT where it would include a “//” comment in the JSON payload to the GET request for my plugin.

Has anyone found ways to prevent it from doing that? It’s generating invalid JSON in the request but I can see no straightforward way to prevent it from doing that through instructions in my OpenAPI spec.

Found a couple of related issues: Comments in JSON payloads and Preventing Comments in JSON Query Body both suggest filtering out comments on the API side!

I use regex to parse these from the json posted to my api

My clean FastAPI code will just have to change to adapt to plugin quirkiness. :sob:

1 Like

Yeah, it’s quite an interesting challenge - most frameworks are deliberately very strict - it’s an API after all.