Use this when working with JSON objects.
Objects · JSON
JSON objects are unordered sets of key-value pairs in curly braces, with string keys, such as {"name": "web01", "port": 443}. Access fields with jq '.name' or $obj.name.
1. Objects are key/value maps with string keys.
2. Keys should be unique.
3. Order not guaranteed.
4. Access with .key in jq.
5. Validate required keys.
{ key: value } → lookup by key
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 Common mistakes Narrow the fault
- Relying on key order.
- Duplicate keys (behaviour undefined).
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.
- Objects are key-value pairs with string keys.
- Key order is not guaranteed.
- Accessing a missing key may return null silently.
jq 'keys' file.json— object keysjq 'has("name")' file.json— key exists- Duplicate keys check — ambiguity
ReferenceWhy it matters1 section · depth on demand
What it is
A JSON object is an unordered set of key/value pairs in {}; keys are strings.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
A JSON object is an unordered collection of key/value pairs inside braces. Keys are strings; values can be any JSON type, including other objects, which is how hierarchical data such as a device with interfaces and addresses is represented.
{"name": "Te1/1/1", "mtu": 9216, "ipv4": {"address": "10.255.0.1", "prefix": 31}}
jq '.ipv4.address' iface.json
jq 'keys' iface.json
Two practical points: key order is not guaranteed, so compare objects structurally (jq -S, json.loads then ==) rather than as text; and duplicate keys are technically allowed but behave differently between parsers — avoid them.
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 JSON > Objects. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc8259 · confidence 94%