Apple Health export.xml to JSON: The Complete Guide (2026)

Apple Health only offers one export format: a monolithic XML file that can hit 1.8 GB for a long-time Watch user. You need JSON for any AI agent, analysis tool, or data pipeline. Here is every method to convert it, ranked by how well they actually work.

By Health Export AI · Updated 18 August 2026 · ~10 min read

Quick answer: You can convert Apple Health's export.xml to JSON using Python scripts (apple-health-extractor), browser-based tools that run locally (applehealthdata.com, twineconvert), streaming parsers in Node.js, Go, or Rust, or the Health Export AI iOS app which skips XML entirely and exports directly as structured JSON. For files over 500 MB you must use a streaming parser. A DOM parser will crash your machine.

Every health data export from Apple starts the same way. You open the Health app, tap your profile picture, scroll down to "Export All Health Data," and wait. After a few minutes a zip file lands on your phone. Inside is a single file: export.xml. For a long-term Apple Watch user this file is routinely 1.2 to 1.8 GB uncompressed, containing millions of Record elements spanning a decade of health data.

That XML file is almost useless as-is. It is structurally complex, uses Apple's internal HealthKit type identifiers (like HKQuantityTypeIdentifierHeartRateVariabilitySDNN), mixes attributes and text nodes, and its sheer size makes it unopenable in most editors. You need JSON. This guide covers every working conversion method in 2026, from a single node script to browser-based tools to an iOS app that makes the whole problem go away.

Why you need JSON, not XML

Large language models like Claude, ChatGPT, and Gemini natively understand JSON better than any other structured format. When you feed an LLM raw XML, it spends context tokens just parsing the hierarchy. With JSON the structure is explicit, the types are preserved (numbers are numbers, dates are ISO 8601 strings), and every metric carries its unit in a predictable field.

Compare these two representations of the same health sample:

<!-- XML -->
<Record type="HKQuantityTypeIdentifierHeartRateVariabilitySDNN"
        sourceName="Apple Watch"
        unit="ms"
        creationDate="2026-01-15 08:30:00 +0000"
        startDate="2026-01-15 08:30:00 +0000"
        endDate="2026-01-15 08:30:00 +0000"
        value="63" />

// JSON
{
  "type": "heart_rate_variability_sdnn",
  "source": "Apple Watch",
  "unit": "ms",
  "value": 63,
  "date": "2026-01-15T08:30:00Z"
}

The JSON version is shorter, the type is human-readable, the date is RFC 3339, and the value is a real number. An AI agent can work with this directly. The XML version requires an extra parsing step before any reasoning can happen.

Note on file sizes. A verified report from early 2026: one user's 10 years of Apple Health data produced a 1.8 GB export.xml with 4.26 million records. Gzip compressed it to 71 MB, but the raw file crashed every DOM-based parser. Only streaming (SAX) parsers could handle it. Source: community reports on Zenn and GitHub.

Method 1: Browser-based converters (zero install)

Several free websites convert export.xml to JSON entirely in your browser. No upload, no server. The processing runs in JavaScript or WebAssembly locally. These tools work well for files up to a few hundred megabytes, but browser memory limits mean they can struggle with full 1.8 GB exports.

  • applehealthdata.com Converts XML to CSV, JSON, or Excel in-browser. Runs locally via WASM. Good for mid-size exports.
  • twineconvert.com Apple Health to JSON converter. Browser-only, no upload. Handles files up to 1-2 GB depending on your device's RAM.

The advantage: nothing to install. The limitation: browser memory caps your maximum file size, and the conversion time blocks your browser tab. For a one-off export under 500 MB this is fine. For repeated use or large datasets you want a local tool.

Method 2: Python scripts

The Python ecosystem has the widest selection of Apple Health XML parsers. The most maintained as of 2026 is apple-health-extractor (PyPI), which handles XML to JSON and CSV conversion with a streaming iterator pattern:

pip install apple-health-extractor
from extractor import Extractor

extractor = Extractor("export.xml")
json_data = extractor.get_json()

This library uses xml.etree.ElementTree under the hood. For export.xml files under 200 MB it works fine. For larger files you must use the streaming version (iterparse) which is available as a separate mode. A community script on GitHub (mhrstmnn/Apple_Health_Export) offers a uv-based converter that handles the iOS 16+ DTD issue by stripping the DOCTYPE declaration before parsing.

The DTD problem. Starting with iOS 16, Apple's export.xml includes a DOCTYPE declaration that references an external DTD file. Many XML parsers (Python's ElementTree included) try to fetch this DTD over the network at parse time. If your computer is offline, or the Apple DTD server is slow, the parse hangs or fails. Every working Python script in 2026 either strips the DOCTYPE line before parsing or uses a parser configured to ignore external entities.

Method 3: Dedicated CLI tools (Go, Rust, Node)

For power users who need to convert massive exports regularly, purpose-built CLI tools are the answer. These use streaming SAX parsers, handle multi-gigabyte files at constant memory, and output clean JSON or SQLite databases.

healthsync (Go, SQLite output)

healthsync parses export.zip into a local SQLite database. It uses a streaming XML parser with DTD stripping via io.Pipe. Verified benchmark: 540,110 records parsed in 30 seconds (18,432 records/second) from a 950 MB export, with heap memory staying around 10 MB. Output is SQLite (not JSON directly), but it has a JSON query flag and a skills file generator for Claude.

openhealth (TypeScript/Bun, Markdown output)

openhealth uses the saxes streaming SAX parser (pure TypeScript) and turns your export into seven Markdown files shaped specifically for LLM consumption. It handles a synthetic 169 MB file with 1 million records in about 5 seconds in Chrome, with heap at 5 MB. Output format is Markdown, not JSON, but it is optimized for AI agents.

vpetersson/apple-health-mcp-server (Rust + DuckDB)

This Rust-based MCP server loads the raw XML (plus ECG CSVs and GPX routes) into a DuckDB database. The Rust implementation handles a 2.5 GB decompressed export in under a minute on a laptop. It uses content-hash deduplication so re-imports only add the delta. Output is queryable via DuckDB, not plain JSON files.

Method 4: Health Export AI (iOS app, direct JSON export, recommended)

All the methods above share a fundamental bottleneck: they start with Apple's monolithic export.xml. You have to export it from your iPhone, transfer it to a computer (often via SCP or AirDrop, which chokes on multi-GB files), and then run a converter. This workflow breaks for most people because a 1.8 GB file is too large to AirDrop reliably and too large to email or message.

Health Export AI takes a different approach. Instead of reading the XML export, it reads Apple Health directly through HealthKit (read-only permission) and writes structured JSON files on-device. The JSON is clean, typed, and organized per metric:

{
  "metric": "heart_rate_variability_sdnn",
  "unit": "ms",
  "samples": [
    { "date": "2026-08-17T08:00:00Z", "value": 61.2 },
    { "date": "2026-08-17T09:00:00Z", "value": 63.8 }
  ],
  "metadata": {
    "source": "Apple Watch",
    "total_samples": 9842,
    "date_range": { "start": "2020-01-01", "end": "2026-08-17" }
  }
}

The app writes this JSON to a destination you choose (iCloud Drive, Dropbox, Google Drive, local network, webhook). No file transfer needed, no massive XML to store twice. The JSON for all 190 metrics is typically 3 to 5 MB total, down from 1.8 GB of XML. That is a 99.7% reduction.

Once the JSON lands on your computer, you can point any MCP server or AI agent at the folder. The open-source health-export-mcp server (zero dependencies, 84 kB) exposes eight read-only tools against that JSON. See the full setup guide for exporting Apple Health to JSON for AI.

Real data point. A 6-year Apple Health dataset (2019 to 2025) with all 190 metrics from a daily Apple Watch user: export.xml = 1.7 GB, JSON from Health Export AI = 4.2 MB. Conversion time: under 5 seconds on-device vs 30 minutes to parse the XML on a MacBook Pro M3. Numbers measured from production usage, July 2026.

Conversion method comparison

Method                   File Limit  Setup   Speed        Output        Recurring
~~~~~~                   ~~~~~~~~~~  ~~~~~   ~~~~~        ~~~~~~        ~~~~~~~~
Browser-based            500 MB      0 min   5-30 sec     JSON/CSV      Manual export
Python scripts           1.8 GB      3 min   5-30 min     JSON/CSV      Manual export
healthsync (Go)          2 GB+       1 min   30 sec       SQLite/JSON   Manual export
openhealth (Bun)         2 GB+       1 min   5-10 sec     Markdown      Manual export
vpetersson (Rust/DuckDB) 3 GB+       2 min   <60 sec      DuckDB SQL    Manual export
Health Export AI (iOS)   Unlimited   2 min   <5 sec       JSON          Auto-syncs

Setup time includes installing dependencies and reading docs. Speed is the time to convert or export a full multi-year dataset. Recurring means how often you need to repeat the process to keep data fresh. Every method except the last requires you to manually trigger "Export All Health Data" from the iPhone every time you want updated data.

Which method should you use?

If you need a one-time conversion of an existing export.xml file, use a browser converter or Python script. You already have the file, and the free tools work.

If you plan to query your health data regularly with AI agents, use Health Export AI. The auto-sync means your JSON is always current. Every manual method forces you to re-export the XML, transfer it, and re-convert it every time your health data changes. That gets old after the second week.

Frequently asked questions

How do I convert Apple Health export.xml to JSON?

You can convert export.xml to JSON using browser-based tools that run locally (applehealthdata.com, twineconvert), Python scripts (apple-health-extractor pip package), dedicated CLI tools (healthsync, openhealth), or the Health Export AI iOS app which produces JSON natively without touching XML.

Why is my Apple Health export.xml so large?

A long-term Apple Watch user can accumulate 1.2 to 1.8 GB of export data, representing roughly 4.26 million records over 10 years. XML is verbose by design. Gzip compresses it to about 4% of original size (1.8 GB to 71 MB), but many parsers still struggle with the raw uncompressed file.

Can I convert Apple Health XML to JSON on my iPhone without a computer?

Yes. Health Export AI reads Apple Health directly (read-only permission) and writes structured JSON to iCloud Drive, Dropbox, or any synced folder. No computer, no XML, no manual export. The JSON is ready for any AI agent immediately.

Why is JSON better than XML for AI agents?

JSON preserves typed data (numbers stay numbers, dates stay machine-readable), has explicit units and metadata, and is the native format LLMs understand best. XML's nested structure with mixed attributes and text nodes forces AI agents to spend context trying to parse the hierarchy instead of reasoning about your data.

Health Export AI · Apple Health to your AI agent, privately. · Home · Privacy · Terms · Support