Skip to content
JSON Tidy
JSON errors

jq: parse error: Invalid numeric literal at line 1, column 10

Updated by John Marshall

jq reads its input before running your filter, so this error means the input isn’t valid JSON and your filter didn’t run. jq found a word it couldn’t parse, such as <!DOCTYPE, HTTP/2 or an unquoted TIDY-002. Anything that doesn’t start like a string, object, array, true, false or null is read as a number, which is why the message says “numeric literal” even when the text has no digits.

The column is the position after that word. Column 10 on line 1 is the character after <!DOCTYPE.

Quick fix

  1. Look at what jq received: replace | jq … with | head -c 300 and run the command again.
  2. If the output starts with <, the server sent a web page. Check the status code and URL, and add -f to curl so error responses don’t reach jq.
  3. If it starts with HTTP/, remove -i from the curl command. If each line starts with a timestamp, strip it with jq -R and fromjson, as shown below.

Fix your JSON

Runs in your browser. Nothing is uploaded.

An HTML page instead of JSON

In this example the API returned an HTML page. The message doesn’t mention HTML:

$ curl -s https://api.crumbpatrol.test/robots | jq '.robots'
jq: parse error: Invalid numeric literal at line 1, column 10

Send the response to head instead of jq to see it:

$ curl -s https://api.crumbpatrol.test/robots | head -c 300
<!DOCTYPE html>
<html>
<head><title>502 Bad Gateway</title></head>

The proxy in front of the API couldn’t get a response from the server behind it, so it sent its own error page. A mistyped path, an expired token or a maintenance window can also return HTML. To print only the status and content type, use -w:

curl -s -w '\n%{http_code} %{content_type}\n' https://api.crumbpatrol.test/robots | tail -n 1

In scripts, add -f. With -f, curl prints nothing for a 4xx or 5xx response and exits with an error, so jq doesn’t receive the error page. With set -o pipefail, the pipeline then fails:

curl -sf https://api.crumbpatrol.test/robots | jq '.robots'

An empty response doesn’t cause this error: jq prints nothing and exits successfully. If a script produces no output and no error, check whether the response was empty.

curl -i puts the headers in front

-i makes curl print the response headers before the body, and jq tries to parse them. Column 7 is the character after HTTP/2:

$ curl -si https://api.crumbpatrol.test/robots/TIDY-002 | jq .
jq: parse error: Invalid numeric literal at line 1, column 7

Remove -i. To see the headers as well, use -v, which prints them to stderr, where jq doesn’t read them.

Log lines with text before the JSON

Many loggers write a timestamp or a level before each JSON object:

2026-11-12T09:30:00Z {"robot": "TIDY-002", "event": "stuck"}
2026-11-12T09:31:00Z {"robot": "TIDY-004", "event": "ERR_CABLE_EATEN"}

jq reads 2026-11-12T09 as a number, fails at the colon after it, and reports column 14:

$ jq . app.log
jq: parse error: Invalid numeric literal at line 1, column 14

Use -R to read each line as a string, remove everything before the first {, and parse the rest with fromjson:

$ jq -R 'sub("^[^{]*"; "") | fromjson | .event' app.log
"stuck"
"ERR_CABLE_EATEN"

If only some lines are JSON, such as startup messages mixed with JSON events, fromjson? skips the lines that don’t parse:

jq -R 'fromjson? | .event' mixed.log

What each column points at

These are the messages jq 1.7.1 gives for each input:

Input starts withMessageWhere it comes from
<!DOCTYPE html>Invalid numeric literal at line 1, column 10An HTML page, usually an error or login page.
HTTP/2 200Invalid numeric literal at line 1, column 7Response headers from curl -i.
Bad GatewayInvalid numeric literal at line 1, column 4A plain-text error from a server or proxy.
{"id": TIDY-002}Invalid numeric literal at line 1, column 16A value without quotes.
{id: "TIDY-002"}Invalid numeric literal at line 1, column 4A key without quotes, as in a JavaScript object.
{'id': 'TIDY-002'}Invalid numeric literal at line 1, column 6Single quotes, often from Python’s print(). jq 1.8 reports this as an invalid string literal instead.

Single quotes together with True or None usually mean a Python dictionary written with print() or str(). Change the script to write it with json.dumps(). For a one-off file, the Fix your JSON box near the top of this page converts it, and the JSON repair page handles longer files.

Once jq can read the input, a filter that doesn’t match the data gives a different error, covered in jq: Cannot index string with string. To test a filter against a saved response, paste the JSON into the jq playground.

The same error elsewhere

jq 1.8, single quotesjq: parse error: Invalid string literal; expected ", but got ' at line 1, column 6
jq, trailing comma in an objectjq: parse error: Expected another key-value pair at line 1, column 34
jq, trailing comma in an arrayjq: parse error: Expected another array element at line 1, column 7
jq, missing commajq: parse error: Expected separator between values at line 1, column 24
jq, cut off in a stringjq: parse error: Unfinished string at EOF at line 2, column 0
Python, same HTML inputjson.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)