Use this when automation exchanges JSON with APIs or tools.
JSON
JSON is the standard data format for APIs and many tools: objects of key-value pairs, arrays, strings, numbers, booleans and null. Parse it with jq, ConvertFrom-Json or json.loads.
1. JSON: objects, arrays, strings, numbers, booleans, null.
2. No comments or trailing commas.
3. UTF-8.
4. Validate with JSON Schema.
5. jq for querying.
JSON text → parser → data structure
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
jq . <file.json>Primary Commands
Configuration and operational commands for this Topic.
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 Example Narrow the fault
jq . data.json
python3 -m json.tool data.json
Step 2 Common mistakes Narrow the fault
- Comments or trailing commas.
- Large integers losing precision in some languages.
Subtopics
Go one level deeper into this subject.
JSON objects are unordered sets of key-value pairs in curly braces, with string keys, such as {"name": "web01", "port": 443}.
Subtopic ArraysJSON arrays are ordered lists in square brackets, such as ["web01", "web02"].
Subtopic Data TypesJSON data types are string, number, boolean, null, object and array.
Subtopic ParsingParse JSON with built-in tools — jq on the command line, ConvertFrom-Json in PowerShell, json.loads in Python — and handle errors when the input is not valid JSON.
Subtopic ValidationValidate JSON first for syntax (jq . or python -m json.tool) and then for structure with JSON Schema, checking required fields, types and allowed values before automation uses the data.
- JSON has objects, arrays, strings, numbers, booleans and null.
- JSON has no comments.
- Parse with jq, ConvertFrom-Json or json.loads.
jq . file.json— validatejq '.items[] | .name' file.json— extractpython3 -m json.tool file.json— pretty print
ReferenceWhy it matters1 section · depth on demand
What it is
JSON is the standard data format for APIs: objects, arrays, strings, numbers, booleans and null, UTF-8 text.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
JSON (JavaScript Object Notation) is a text format for structured data built from objects (key/value maps), arrays, strings, numbers, booleans and null. It is the common language of web APIs, many configuration files and logging systems, and nearly every programming language can read and write it.
{
"device": "sw-oslo-07",
"vlans": [10, 20],
"uplink": { "interface": "Te1/1/1", "enabled": true },
"notes": null
}
Rules that cause most errors: keys and strings must use double quotes, no trailing commas, no comments, and numbers have no leading zeros. Validate with jq . file.json or python -m json.tool file.json.
Mechanics
The linked authority for bounded mechanics is RFC 8259 — The JavaScript Object Notation (JSON) Data Interchange Format; documentation support is separate from observed lab/production Evidence.
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 Data Formats > JSON. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc8259 · confidence 94%