Convert Email to JSON: Parse Inbound Email to a JSON API

Last updated August 2026

Try it now: extract email data to Excel, CSV, or JSON

Convert your email files
No install

Connect a mailbox to pull .eml/.msg in bulk, or paste a raw email to test the converter now.

or paste an email to test
Output format
Columns to extract
Extract your own custom fields
Popular:

Create a free account to download. No credit card required.

Want clean JSON from your inbound email without writing a MIME parser?

Point email at MailParse, name the fields you want, and get a structured payload POSTed to your endpoint. Use the email parser API to convert email to JSON, or read the practical walkthrough below first.

Plenty of useful data starts life as an email: a lead from a web form, an order confirmation from a marketplace, an invoice from a supplier, an alert from a monitoring tool. The trouble is that an email is not a tidy record. It is a MIME document with nested parts, base64 attachments, quoted-printable bodies, encoded-word headers, and often a forwarded chain stacked underneath. To use any of that in your application you first have to turn it into something predictable, and predictable usually means JSON. This guide covers how to convert email to JSON in practice, what the output actually contains, and where the work is genuinely hard so you can decide what to build versus what to hand off.

How do I convert an email to JSON?

You have two practical routes. Either point an email parsing API at your inbound mail so each message is decoded into a JSON object and POSTed to your endpoint, or convert email to JSON by uploading exported message files in a batch. Both turn raw MIME into named fields (sender, recipients, subject, text and HTML bodies, headers, and attachments) so your code reads structured data instead of a raw message.

The API route fits live workflows where email keeps arriving and you want each one handled the moment it lands. The file route fits a backlog: a folder of saved messages you need as structured data once. Writing the parser yourself is the third route, and the rest of this guide explains why most teams stop reaching for it once they see what a complete MIME parser has to handle.

What does parsed email JSON look like?

A parsed email becomes a flat, predictable object: top-level fields for the envelope (from, to, subject, date), the body in both plain text and HTML, an array of headers, an array of attachments with metadata, and any custom fields you defined. Encodings are normalized to UTF-8 so you never deal with base64 or quoted-printable in your own code. A typical payload looks like this:

{
  "from": { "name": "Acme Supply", "email": "[email protected]" },
  "to": [{ "email": "[email protected]" }],
  "subject": "Order #10482 confirmed",
  "date": "2026-06-16T14:02:11Z",
  "text_body": "Your order #10482 is confirmed. Total: $312.40 ...",
  "html_body": "<html>...</html>",
  "fields": {
    "order_id": "10482",
    "order_total": "312.40",
    "ship_date": "2026-06-18"
  },
  "attachments": [
    { "filename": "invoice.pdf", "content_type": "application/pdf", "size": 48213 }
  ],
  "headers": { "message-id": "<...>", "spf": "pass" }
}

The two parts that earn their keep are fields and attachments. The standard envelope is easy; what you usually want is the order number or invoice total pulled out of the body as its own value, and any attachment decoded and described rather than buried in the raw message.

How do I parse an incoming email with an API?

Forward mail to a dedicated parsing address or connect a Gmail, Outlook, or IMAP mailbox, define the fields you want extracted, and the API decodes each message and POSTs the JSON to a webhook URL you control. Your endpoint validates the payload and writes it wherever it needs to go. There is no mail server to run and no MIME tree to walk in your own code.

The connect-a-mailbox option matters when you cannot change MX records or route mail to a new address, which is common inside an existing Microsoft 365 or Google Workspace tenant. Either way the contract is the same: an email arrives, you receive structured JSON. The email parser API page shows the full inbound-to-webhook flow and the field configuration.

Can you convert email attachments to JSON?

Yes, with a distinction worth understanding. The attachment itself is extracted, decoded from base64, and described in the JSON with its filename, content type, and size, so your code can store or route it. Pulling the data out of a PDF or spreadsheet attachment is a second step: the parser reads the file contents and returns named fields, rather than leaving you a binary blob to handle.

That second step is where most simple parsers stop. Decoding an attachment is straightforward; turning a PDF invoice or a CSV into structured columns is real extraction work. If your inbound mail carries documents you need as data, look for a tool that turns those documents into data, not just one that lists attachment files. Our walkthrough on how to extract data from email attachments covers the PDF and CSV cases in detail.

How do I send parsed email data to a webhook?

Configure the parser with your endpoint URL, and it sends an HTTP POST containing the JSON payload the instant a message is parsed. Your application receives the data in real time instead of polling a mailbox on a schedule. You typically verify a signature or shared secret on the request, validate the payload against your schema, then write it to a database, a queue, or your CRM.

Webhooks are the difference between reacting to email and chasing it. A cron job that polls an inbox reparses the same messages, fights duplicates, and adds latency. A webhook fires once per message, carries the structured result with it, and lets the rest of your workflow start immediately. For storing the result, mapping clean JSON fields to your table columns is a single insert per email.

Can I convert an EML or MSG file to JSON?

Yes. Exported message files in .eml or .msg format are just MIME (or Outlook's compound binary, in the case of .msg), and a parser decodes them into the same JSON structure as live mail. This is the route for a backlog: a folder of saved messages, a mailbox export, or evidence files you need as structured data in one pass rather than as an ongoing feed.

If your goal is a spreadsheet rather than a JSON payload, the same decoding produces CSV or Excel just as easily, since both come from the same parsed structure. Our EML to CSV converter handles uploaded .eml and .msg files when you want columns instead of an API response, and you can switch the output to JSON when you need it for code.

Why is parsing raw email so hard?

Because email was designed to be human-readable and backward-compatible, not machine-clean. A single message can mix multipart/alternative and multipart/mixed sections, encode the body as base64 or quoted-printable, wrap non-ASCII headers in encoded-words, attach files inline by content ID, and bury the real content under a forwarded chain with its own headers. Handling every legitimate variation is a large, unglamorous job.

The naive version (read the body, split on a keyword) works in a demo and breaks in week two, the first time a sender restyles their template or sends HTML where you expected text. A maintained parser absorbs that variation so your code does not. That is the actual value of a parsing service: not the happy path, which is easy, but the long tail of malformed and unusual messages that would otherwise land in your error logs.

Is there a free way to convert email to JSON?

You can create a free account to see the parsed JSON shape and test your webhook before you build against it, which is the sensible first step. Open-source libraries also exist if you want to parse MIME yourself in code, though you then own the edge cases, the mailbox connection, and the uptime. Paid plans cover the volume, scheduled mailbox sync, and reliability that production workloads need.

The honest trade-off is build versus buy. Parsing one clean message yourself is free and quick; parsing every message reliably, at volume, with attachments and custom fields, is the part teams usually decide is not worth maintaining in-house. Test the output free, then weigh the volume you expect against the time a homegrown parser will take to keep working.

The short version: convert email to JSON either by pointing an API at your inbound mail and receiving a webhook, or by uploading exported .eml and .msg files for a batch. The output is a predictable object with the envelope, both body formats, decoded attachments, and the custom fields you name. The easy part is the happy path; the value is in the MIME edge cases and encoding quirks you would otherwise handle yourself. When you are ready to skip that work, the email parser API returns clean JSON on your webhook, or compare your options in our email parser buyer guide.