Skip to content
ParsedMail

Parse email to JSON

To parse an email to JSON, forward it to a ParsedMail inbox whose schema lists the fields you need, for example order number, total and delivery date. Within seconds you get a JSON object with those keys, typed values and a confidence score per field.

Email received

From: Northwind Supply <[email protected]> Subject: Order #NW-48213 confirmed Order number: NW-48213 Customer: Dana Ortiz, Ortiz Coffee Roasters 2 x Burr grinder K6 @ $189.00 5 x Ceramic dripper, white @ $24.50 Total: $500.50 Estimated delivery: October 21, 2026

Fields described as

order number, customer name, products with quantity and price, total, delivery date

JSON delivered to your webhook

{
  "order_number": "NW-48213", 0.99
  "customer_name": "Dana Ortiz, Ortiz Coffee Roasters", 0.95
  "products": [
    {
      "name": "Burr grinder K6",
      "quantity": 2,
      "price": { "amount": 189, "currency": "USD" }
    },
    {
      "name": "Ceramic dripper, white",
      "quantity": 5,
      "price": { "amount": 24.5, "currency": "USD" }
    }
  ], 0.96
  "total": { "amount": 500.5, "currency": "USD" }, 0.98
  "delivery_date": "2026-10-21" 0.94
}

Why converting email to JSON is harder than it looks

An email is a MIME document: headers, a plain text part, an HTML part, inline images and attachments, often encoded in base64 or quoted-printable. Splitting those parts is a solved problem. The hard part is the next step, finding "the total" in a body that one sender writes as Total, another as Amount due and a third puts in the last cell of an HTML table.

Libraries such as Python's email package or Node's mailparser give you the parts. They do not give you order_number. That mapping is what usually ends up as a pile of regular expressions per sender.

Three ways to get JSON out of an email

ApproachHow it worksBreaks when
Regex in your codePatterns per sender and per fieldThe sender changes a word or the layout
Template parsersYou highlight values in a sample emailA new layout arrives without a template
AI email parserA model reads the email against a typed schemaRarely; low confidence is flagged for review

ParsedMail is the third kind. It still gives you the predictability of a schema: the same keys and types every time, validated before they leave. See how it works as an email parsing API.

What the JSON looks like

Every parsed email becomes one object. Keys come from your schema and keep their order. Values are typed:

  • Dates as YYYY-MM-DD, date-times as ISO 8601
  • Money as {"amount": 552.4, "currency": "USD"}
  • Tables such as line items as arrays of row objects
  • Missing values as null, never as a guess

Around the data the webhook body adds the email id, sender, subject, attachments, a confidence object with a score from 0 to 1 per field and a needs_review flag. The full format is in the webhook documentation.

Parse one email synchronously with the API

If you already have the email in your own system, skip the inbox and call the parse endpoint directly:

curl https://parsedmail.com/api/v1/parse \
  -H "Authorization: Bearer $PARSEDMAIL_KEY" \
  -H "Content-Type: application/json" \
  -d '{"description": "invoice number, due date, total", "email": "Subject: Invoice 0917 ..."}'

The response contains data, confidence and any warnings. Each call counts as one email on your plan. The API reference lists every parameter.

Attachments land in the same JSON

When the values sit in a PDF invoice or a CSV order file, ParsedMail reads the attachment and merges what it finds with the body, including line-item tables. Scanned PDFs are read as images on paid plans. Read more about parsing email attachments.

Frequently asked questions

Can I convert an email to JSON without writing code?

Yes. Create an inbox, describe the fields and point a Zapier, Make or n8n webhook trigger at it. The JSON arrives in the automation as structured fields.

Is the output always valid JSON?

Yes. The model output is parsed and every field is coerced to its declared type before delivery. A value that cannot be read becomes null with a warning.

Can I get the JSON Schema for my fields?

Yes. Every schema has a JSON Schema (draft 2020-12) in the dashboard and in the API response for GET /v1/schemas/{id}.

What about HTML-only emails?

HTML bodies are converted to text with table rows preserved, so values in table cells are found like any other text.

How fast is it?

Most emails are parsed within a few seconds of arrival. Large PDFs take longer.

Related

See your own email as JSON

Paste one into the demo, describe the fields and look at the result. No account needed.