⌨️--output-format Flag
Also known as claude --output-format, --output-format json, stream-json
It picks the shape of what claude -p prints.
Think of it like
It is like you ask for a note, a form or a call. It is the same news each way.
Example
Jack's script needs the session ID so it can resume later. It runs claude -p with --output-format json and reads session_id from the result.
Why it matters
Definition
Example code
bash
claude -p "Summarize this project" --output-format jsonCommon mistake
Key takeaways
- 1text. Just the answer.
- 2json. One object at the end.
- 3stream-json. A line per event.