cd /news/developer-tools/parsing-chatgpt-s-nested-mapping-tre… · home › topics › developer-tools › article
[ARTICLE · art-176989] src=dev.to ↗ pub= topic=developer-tools verified=true sentiment=↑ positive

Parsing ChatGPT's Nested Mapping Tree and Export ZIPs in Zero-Dependency Browser JS

A developer published a zero-dependency browser JavaScript technique for converting ChatGPT and Claude data exports into clean Markdown, using the native DecompressionStream API to inflate ZIP archives client-side and walking the current_node parent chain to extract only the active conversation branch. The approach avoids JSZip and CDN requests, keeping the converter in a single standalone HTML file, and adds YAML frontmatter so exported threads are queryable in Obsidian Dataview or Bases. The developer also disclosed building ThreadAttic, a local-only Chrome extension for folders, pins, search and one-click Markdown export inside chatgpt.com and claude.ai.

key takeaway

Walk from chat.current_node back through parent pointers and reverse the chain to extract only the active branch, and inflate ZIP entries with DecompressionStream('deflate-raw') to parse exports without JSZip.

read2 min views13 publishedNov 26, 2026

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.)

── more in #developer-tools 4 stories · sorted by recency
── more on @chatgpt 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/parsing-chatgpt-s-ne…] indexed:0 read:2min 2026-11-26 · —