You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
claudbg/.beans/claudbg-pfa5--json-output-i...

1.6 KiB

title status type priority created_at updated_at parent
JSON output is array-of-arrays instead of array-of-objects completed bug normal 2026-03-30T04:37:05Z 2026-03-30T05:05:12Z claudbg-tci9

Problem

sessions list --output json and sessions dump --output json serialize rows as Vec<Vec<String>>, producing an array of arrays with no field names:

[["21fae0a8", "2024-01-01", "/path", "claude-3", "42"], ...]

Expected behavior

Output should be an array of objects with named keys:

[{"id": "21fae0a8", "date": "2024-01-01", "project": "/path", "model": "claude-3", "messages": 42, "subagents": 0}, ...]

Affected commands

  • sessions list --output json: keys should be id, date, project, model, messages, subagents
  • sessions dump --output json: keys should be seq, timestamp, type, role, content

Root cause

src/commands/sessions.rs passes &rows: &Vec<Vec<String>> directly to render_json. The fix is to build a typed struct or serde_json::Value map per row before serializing.

Relevant files

  • src/commands/sessions.rslist() and dump() JSON output branches
  • src/output/json.rs — generic render_json

Summary of Changes

Fixed JSON output in both sessions.rs and agents.rs to produce array-of-objects instead of array-of-arrays. Each row is now mapped to a serde_json object with named keys before serializing. Keys: sessions list (id, date, project, model, messages, subagents), sessions dump (seq, timestamp, type, role, content), agents list (id, type, file, modified), agents dump (seq, timestamp, type, role, content).