JSON
Cheat sheet · https://pcornel.dk/topic.php?topic=5306
Answer
JSON representation semantics for API payloads, including types, null, arrays/objects, numeric precision and schema validation.
Remember
- JSON parsed ≠ schema valid; syntax allows structures the API may reject or reinterpret.
- JSON number ≠ exact arbitrary precision; large integers and decimals can lose precision in clients.
- null ≠ absent; APIs often assign different update/default semantics to each.
- Object key order ≠ semantic order; consumers must not depend on serialization order.
First checks
curl -sS <url> | jq .— parse JSON- Content-Type: application/json check — before parsing
jq -e '.error' response.json— detect error objects
Verify in this order
response body → JSON parser → objects
Where it usually breaks
Successful JSON parsing proves only syntactic validity; type coercion, schema and business semantics remain unproven.
Client payload/auth → HTTP transport → endpoint validation/policy → request accepted → queued/job execution → target mutation → effective state → consumer workload.
JSON API boundary map
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Caller / request | Environment/version, identity and exact request contract are attributable | Hidden defaults, wrong endpoint/version, leaked or mismatched credentials |
| Server / response | Status, headers, structured body and request ID are interpreted together | Status-only handling, ignored error body, ambiguous async result or unsafe retry |
| State / proof | Write result is reconciled with resource read-back or acceptance test | Response success treated as final target success without verification |
| Troubleshooting | First failed boundary is preserved, changed minimally and retested | Blind retries, credential rotation, replay or payload edits before evidence is captured |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5306