{
  "slug": "stern-extractjsonparts-supports-nested-json-fields-with-dot-notation-06061309747e",
  "title": "stern extractJSONParts supports nested JSON fields with dot notation",
  "tools": [
    "stern"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-10-22T13:57:05.000Z",
  "announced_at": "2026-10-22T13:57:05.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When formatting JSON log messages, use Stern’s template functions with dot notation to extract fields nested in JSON objects. For example, extract `python.levelname` from `.Message` with `extractJSONParts`.",
    "examples": [
      "stern --template='{{ extractJSONParts .Message \"python.levelname\" \"message\" }}{{\"\\n\"}}' backend",
      "stern --template='{{ extractJSONParts .Message \"python.levelname\" }}{{\"\\n\"}}' backend"
    ],
    "gotchas": [
      "Version: v1.35.0",
      "--template: Custom Go template applied to each log message.",
      ".Message (required): String passed to the extraction function for JSON parsing.",
      "extractJSONParts (required): Parses the input string as JSON and concatenates the specified keys; keys may use dot notation to access nested fields.",
      "tryExtractJSONParts: Attempts JSON parsing and concatenates the specified keys using dot notation for nested fields; returns the text on failure.",
      "<pod-query> (required): Positional pod query; the documented example uses `backend`.",
      "A literal top-level key is tried first, preserving existing flat-key usage, including keys that already contain a dot."
    ]
  },
  "why_it_matters": "When formatting JSON log messages, extract fields nested inside JSON objects.",
  "before": "For nested JSON fields, `extractJSONParts` and `tryExtractJSONParts` did only a flat top-level key lookup, so a dotted key rendered as `<nil>`.",
  "sources": [
    "https://github.com/stern/stern/releases/tag/v1.35.0",
    "https://github.com/stern/stern/pull/373",
    "https://github.com/stern/stern/blob/master/README.md"
  ],
  "rank": 0.98028,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "daily-20261026-04",
    "verdict_id": "daily-20261026-04:daily-20261026-04-2bb809857702a5f4-2:gate",
    "evidence_hash": "92cc09ae9359c40e6295011164e5381205668838a445e5960e6992f5509942ca"
  },
  "review": {
    "draft_hash": "e32c29f71cb63f506988901ad3ffc31653e931beadd101837f67c5796cef6ad3",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-22T13:57:05.000Z",
    "decision": "daily-20261026-04:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.98 >= 0.9; 2 needed) and Jev gave 0.71 (>= 0.6 needed)."
  }
}
