I had the very same problem working on a C++ project.
As soon as a source code file was open (e.g. a cpp or hpp file) hitting F5 would result in the pop-up saying
Failed to parse json file, possibly due to comments or trailing commas.
and debugging wouldn't start.
If all source code files were closed, hitting F5 started debugging as intended.
The problem for me was that my tasks.json file contained a long shell command which was using backslashes to spread it over multiple lines. Even though the command surprisingly worked it seemed to trip a JSON parser in one spot. Once I fixed the command F5 worked like a charm again.
Extra info:
The message seems to come from here: https://github.com/microsoft/vscode-cpptools/blob/main/Extension/src/common.ts (microsoft/vscode-cpptools).