JSON Types and Values/Inspect a value type with jq

Quickly verify the parsed type of a JSON value.

Section: Number gotchas

Inspect a value type with jq

bash
bash
jq 'type' <<< '123'
Explanation

Helpful when checking how a parser sees a value after serialization.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Number gotchas
Avoid leading zeros
Leading zeros are invalid except for zero itself.
OpenIn sheetjsonsame section
Scientific notation
JSON supports exponent notation.
OpenIn sheetjsonsame section
Do not use NaN or Infinity
They are not valid JSON numbers.
OpenIn sheetjsonsame section
String value
A sequence of Unicode characters inside double quotes.
OpenIn sheetjson1 tag match
Escape quotes inside strings
Use backslash to include literal double quotes.
OpenIn sheetjson1 tag match
Number value
JSON supports integers and decimals.
OpenIn sheetjson1 tag match