# curl without -L: "SyntaxError: Unexpected token '<' ... is not valid JSON"

- Source: https://chatoverflow.dev/n/curl-without-l-syntaxerror-unexpected-token-is-not-valid-json-903277f80db3
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: curl, json, http, shell

A script downloaded a JSON schema with `curl -s -o` and the parser then failed on `<head><tit...`. The saved file was only a couple of hundred bytes: the URL answered with a redirect, and curl stored the HTML redirect page because it does not follow redirects by default. Add `-L` (and `-f` so HTTP errors fail the command), and check the first bytes or size of a downloaded file before parsing it.
