If you have ever requested an official data export from ChatGPT (Settings → Data Controls → Export), you get a .zip containing a massive conversations.json file.
Try opening it in an editor and you immediately hit two annoyances:
mapping graph of node IDs, parent pointers, hidden system prompts, and discarded regenerations.
Here is how to parse both ChatGPT's .zip / mapping tree and Claude's conversations.json into clean, Obsidian-ready Markdown completely client-side with zero external libraries.
conversations.json from a .zip using native DecompressionStream
You do not need JSZip or a bundler to read a ZIP archive in modern browsers. A standard ZIP file ends with an End of Central Directory (0x06054b50) record pointing to each entry's offset, compression method (0 = stored, 8 = deflate), and sizes.
Once you slice the compressed bytes from the local file header (0x04034b50), the browser's built-in DecompressionStream('deflate-raw') inflates it natively:
async function inflateRaw(compressedBytes) {
const ds = new DecompressionStream('deflate-raw');
const writer = ds.writable.getWriter();
writer.write(compressedBytes);
writer.close();
const buf = await new Response(ds.readable).arrayBuffer();
return new Uint8Array(buf);
}
That keeps the entire converter in a single standalone HTML file with zero CDN requests.
current_node branch cleanly
A naive Object.values(chat.mapping) breaks conversation order and mixes in edited/regenerated branches you threw away. Instead, start from chat.current_node and walk node.parent back to the root, then reverse:
function extractActiveBranch(chat) {
const mapping = chat.mapping || {};
const chain = [];
const seen = new Set();
let id = chat.current_node;
while (id && mapping[id] && !seen.has(id)) {
seen.add(id);
chain.push(mapping[id]);
id = mapping[id].parent;
}
chain.reverse();
return chain
.map(n => n.message)
.filter(m => m && (m.author?.role === 'user' || m.author?.role === 'assistant'))
.map(m => ({
role: m.author.role,
created: m.create_time || null,
text: Array.isArray(m.content?.parts)
? m.content.parts.filter(p => typeof p === 'string').join('\n\n').trim()
: ''
}))
.filter(m => m.text.length > 0);
}
For Claude exports (conversations.json), the schema is simpler: each entry has name, created_at, updated_at, and a flat chat_messages array with sender: 'human' | 'assistant' and text / content blocks.
Adding lightweight YAML properties makes exported threads immediately queryable in Obsidian Dataview or Bases:
---
title: "Postgres Indexing Checklist for SaaS"
source: chatgpt
created: 2026-11-06
updated: 2026-11-06
messages: 3
tags:
- ai-chat
- chatgpt
---
(Disclosure: I also build ThreadAttic, a small local-only Chrome extension that adds folders, pins, search, saved prompts, and one-click Markdown export directly inside chatgpt.com and claude.ai — free up to 20 folders, no account. The JSON→Markdown converter above is completely free, standalone, and MIT-licensed.)