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
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
| Approach | How it works | Breaks when |
|---|---|---|
| Regex in your code | Patterns per sender and per field | The sender changes a word or the layout |
| Template parsers | You highlight values in a sample email | A new layout arrives without a template |
| AI email parser | A model reads the email against a typed schema | Rarely; 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?
Is the output always valid JSON?
Can I get the JSON Schema for my fields?
GET /v1/schemas/{id}.
What about HTML-only emails?
How fast is it?
Related
See your own email as JSON
Paste one into the demo, describe the fields and look at the result. No account needed.