You call JSON.parse() (or res.json()) and get:

SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

Before you hunt for a missing comma — most of these errors aren't broken JSON at all.

"Unexpected token <" → you got HTML, not JSON

The #1 cause, and it has nothing to do with your JSON. The server returned an HTML page (a 404, a login redirect, a Cloudflare challenge) and your code parsed it as JSON.