Use this when JSON types like dates, big numbers or null cause errors in automation.
Data Types · JSON
JSON data types are string, number, boolean, null, object and array. There is no date or integer type, so dates are strings and very large numbers may lose precision in some parsers.
1. JSON types: string, number, boolean, null, object, array.
2. Large integers may lose precision in some languages.
3. Don't quote numbers/booleans unintentionally.
4. No date type — use ISO 8601 strings.
5. Validate types with schema.
value → JSON type → consumer expects type
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
The negative fixture should deliberately exercise risks such as encoding/BOM issues, delimiter/quoting ambiguity, duplicate keys, namespace drift, scalar coercion, invalid schema assumptions and parser success without consumer-valid semantics, choosing the cases most relevant to built-in scalar types, typedef, union, enumeration/bits, leafref/identityref and range/length/pattern restrictions.
Step 2 Common mistakes Narrow the fault
- "true" (string) instead of true (boolean).
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- JSON has no date type; dates are strings.
- Very large numbers may lose precision.
- null and missing keys are different.
jq 'type' file.json— top-level typejq '.port | type' file.json— field type- Numbers vs strings ("80" vs 80) — type consistency
ReferenceWhy it matters1 section · depth on demand
What it is
JSON types: string, number, boolean, null, object, array. There is no date type — dates are strings, usually ISO 8601.
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
JSON has six data types: string, number, boolean, null, object and array. There is no date, integer/float distinction or binary type, so those are conventions on top of strings and numbers.
| Need | Convention |
|---|---|
| Date/time | ISO 8601 string "2026-11-05T10:15:00Z" |
| Large integers (IDs > 2^53) | String, to avoid precision loss in JavaScript |
| Binary | Base64 string |
Leading zeros ("007") | String |
| Unknown vs empty | null vs "" or [] — choose deliberately |
Type mismatches are a frequent API error: sending "20" where the schema expects 20 returns 400. Check the API schema, and convert types explicitly in scripts.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in JSON > Data Types. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc8259 · confidence 94%Deep reference
Healthy vs suspicious evidence
Output interpretation
For built-in scalar types, typedef, union, enumeration/bits, leafref/identityref and range/length/pattern restrictions, prefer typed fields and stable IDs over human presentation text.