Skip to main content

parse_chatgpt_export

Function parse_chatgpt_export 

Source
pub fn parse_chatgpt_export(content: &str) -> Option<Vec<ParsedEvent>>
Expand description

Parse a ChatGPT data-export conversations.json file: parses the whole file at once (unlike the line-at-a-time parse_cc_line/parse_codex_line) and returns every message-bearing event across every conversation, in deterministic DFS preorder per conversation.

Returns None when content is not valid JSON or the top level is not a JSON array — the caller treats that as a per-file error so the mirror cursor does not advance. A malformed conversation inside an otherwise- valid array is skipped individually, not the whole file. The returned raw and text fields have secrets masked, exactly like parse_cc_line/parse_codex_line. See crates/khive-pack-session/docs/api/mirror-parse.md for the DFS/sidechain algorithm detail.