Pcornel
Automation · Data Formats › JSON

Objects

Cheat sheet · https://pcornel.dk/topic.php?topic=5819

Back to the Topic

Answer

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.

Remember

  • Objects are key-value pairs with string keys.
  • Key order is not guaranteed.
  • Accessing a missing key may return null silently.

First checks

  • jq 'keys' file.json — object keys
  • jq 'has("name")' file.json — key exists
  • Duplicate keys check — ambiguity

Verify in this order

{ key: value } → lookup by key

Where it usually breaks

Client payload/auth → HTTP transport → endpoint validation/policy → request accepted → queued/job execution → target mutation → effective state → consumer workload.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5819

Confirmation

Confirm action

Continue?