Zum Hauptinhalt springen
🕵️ SicherheitslückenCVE-2022-44368 | NASM 2.16 null pointer dereference (EUVD-2022-47313)(18.09.2026 um 03:34 Uhr)
🔧 ProgrammierungBuilding a Browser-Based Voxel Editor with React Three Fiber(18.09.2026 um 03:24 Uhr)
🔧 ProgrammierungThe Bottleneck Moved From Writing Code to Proving It(18.09.2026 um 03:32 Uhr)
🕵️ SicherheitslückenCVE-2022-44368 | NASM 2.16 null pointer dereference (EUVD-2022-47313)(18.09.2026 um 03:34 Uhr)
🔧 ProgrammierungBuilding a Browser-Based Voxel Editor with React Three Fiber(18.09.2026 um 03:24 Uhr)
🔧 ProgrammierungThe Bottleneck Moved From Writing Code to Proving It(18.09.2026 um 03:32 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Fixing broken JSON: why "Unexpected token" usually isn't a JSON problem

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.

const res = await fetch(url);
const text = await res.text();
console.log(text.slice(0, 200)); // <!DOCTYPE html>... there is your answer

Now it's a request problem (wrong URL, missing auth, expired token) — fix the request, not the parser.

"Unexpected token o at position 1" → you double-parsed

The o is from [object Object]. You parsed something already parsed — fetch().then(r => r.json()) parses for you. Don't do it twice.

Actually-broken JSON

When it is malformed, it's almost always: trailing commas ({"a":1,}), single quotes, unquoted keys ({a:1}), comments (JSON has none), Python values (True/None), or missing brackets from a truncated copy-paste.

Fix it fast

Find the exact line with a validator; auto-fix the lenient cases with JSON5.parse() or a repair tool. For a quick browser fix I use https://jsonviewertool.com/json-repair (rewrites trailing commas, single quotes, unquoted keys to strict JSON) and https://jsonviewertool.com/json-validator to pinpoint the error line — both client-side.

10-second triage

  • Mentions < → HTML, not JSON. Fix the request.
  • Mentions o at position 1 → you double-parsed.
  • Anything else → malformed → validate + repair.
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Fixing broken JSON: why "Unexpected token" usually isn't a JSON problem

Thematisch verwandte Begriffe: Fixing, broken, JSON, Unexpected · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-61591 | djust provides Phoenix LiveView-style reactive server-side rendering for…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
News ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

↗ Original-Quelle