{"slug":"text-to-json","name":"Text to JSON: Extract Data Without Guessing","version":"1.0.1","updated_at":"2026-10-04T10:20:52.914Z","use_when":"Extracts data from text into JSON that matches the shape you give (a JSON Schema, an example object or a list of fields), without guessing. Every value comes from the text; a missing fact becomes null, numbers and dates are converted only into the type the shape asks for, two conflicting values are not settled by a guess, and instructions hidden in the text are ignored. Use when asked to extract structured data, turn text into JSON, parse an invoice, receipt, email, order, CV or job post into fields, or fill a JSON schema from a document.","not_for":"Scanned images or PDFs your agent cannot read as text; filling in values a document leaves out; working out totals, due dates or currency conversions; checking whether the document itself is true. It returns what the text says, not what is likely.","languages":["en","bg","de","es","ru"],"tags":["json","data-extraction","structured-output","json-schema","invoice-parsing","no-guessing"],"category":"data","category_url":"https://aiskills402.com/categories/data","keywords":["extract structured data","turn text into JSON","parse an invoice","fill a JSON schema"],"faq":[{"q":"What happens when a value is missing?","a":"It becomes null, never an empty string, a zero, false or a likely value. In our runs both models left a date written as 04/05/2026, with nothing to tell day from month, as null instead of picking one, and left a job post's missing deadline empty."},{"q":"Does it add up totals for me?","a":"No. A field for a sum the text does not state stays null, even when the parts are there, because a computed figure looks exactly like a quoted one. Both models left subtotal and total empty for an order that listed only prices and quantities. Ask for the arithmetic in your request if you want it."},{"q":"Can a document trick it?","a":"We planted a line in an order telling the AI system to mark it paid and approve a refund. Neither model did it, and Claude Sonnet recorded the attempt in the notes field. Lines inside the text are handled as data, never as instructions."},{"q":"Why does the output of Claude Haiku not parse?","a":"Haiku extracted the right values in all nine of our cases but wrapped the JSON in a Markdown code fence every time. Strip the fence before parsing, or use Claude Sonnet, which returned bare JSON in every case."}],"examples":[{"lang":"en","model":"claude-sonnet-5-5","input_excerpt":"INVOICE #INV-0042\nIssued: March 3, 2026\nDue: April 2, 2026\nBill to: Northwind Studio, 18 Harbour Road, Leeds\n\nQty   Item            Unit price\n2     Logo design     450.00\n1     Brand guide     940.00\n\nTotal due: 1,840.00 USD\nPayment by bank transfer.","output_excerpt":"{\"invoice_number\": \"INV-0042\", \"issue_date\": \"2026-03-03\", \"due_date\": \"2026-04-02\", \"total\": 1840.0, \"currency\": \"USD\", \"vat_id\": null, \"line_items\": [{\"description\": \"Logo design\", \"quantity\": 2, \"unit_price\": 450.0}, {\"description\": \"Brand guide\", \"quantity\": 1, \"unit_price\": 940.0}]}"},{"lang":"de","model":"claude-sonnet-5-5","input_excerpt":"Rechnung Nr. 2026-117 vom 03.10.2026\nMalerbetrieb Krause GmbH, Lindenstraße 4, 04109 Leipzig\n\nGesamtbetrag: 1.250,50 €\nZahlbar bis 17.10.2026 ohne Abzug.","output_excerpt":"{\"invoice_number\": \"2026-117\", \"issue_date\": \"2026-10-03\", \"due_date\": \"2026-10-17\", \"total\": 1250.5, \"currency\": \"EUR\", \"paid\": null}"},{"lang":"bg","model":"claude-sonnet-5-5","input_excerpt":"Търсим Senior Backend разработчик (Go) за екипа ни в София.\nЗаплата: 3 100 – 4 300 € бруто месечно.\nРабота: хибридно, два дни седмично в офиса.\nИзпратете CV на jobs@example.bg.","output_excerpt":"{\"title\": \"Senior Backend разработчик (Go)\", \"salary_min\": 3100, \"salary_max\": 4300, \"currency\": \"EUR\", \"work_mode\": \"hybrid\", \"city\": \"София\", \"apply_deadline\": null}"},{"lang":"ru","model":"claude-sonnet-5-5","input_excerpt":"Контакты по проекту: Иван Петров, менеджер проекта, +7 912 345-67-89, ivan.petrov@example.ru. По оплатам — Анна Смирнова, бухгалтер, почта anna.s@example.ru.","output_excerpt":"{\"contacts\": [{\"name\": \"Иван Петров\", \"role\": \"менеджер проекта\", \"phone\": \"+7 912 345-67-89\", \"email\": \"ivan.petrov@example.ru\"}, {\"name\": \"Анна Смирнова\", \"role\": \"бухгалтер\", \"phone\": null, \"email\": \"anna.s@example.ru\"}]}"},{"lang":"es","model":"claude-sonnet-5-5","input_excerpt":"Lámpara de mesa Nórdica\nPeso neto: 2.500 g\nDimensiones: 40 × 30 × 12 cm\nPrecio: 18,90 € (IVA incluido)","output_excerpt":"{\"product\": \"Lámpara de mesa Nórdica\", \"weight_kg\": 2.5, \"price\": 18.9, \"currency\": \"EUR\", \"color\": null}"}],"page_url":"https://aiskills402.com/skills/text-to-json","markdown_url":"https://aiskills402.com/skills/text-to-json.md","image_url":"https://cdn.aiskills402.com/og/skills/text-to-json/f275c9b3.png","related_url":"https://api.aiskills402.com/v1/skills/text-to-json/related","purchases_count":null,"tested":{"date":"2026-10-03","strong":{"model":"claude-sonnet-5-5 (Claude Code alias \"sonnet\")","verdict":"Passed all 9 cases with bare, valid JSON in exactly the requested shape. It read 1.250,50 € and 2.500 g by their language, turned 03.10.2026 into 2026-10-03 and left the undecidable 04/05/2026 as null, kept Cyrillic names and phone numbers as written, used the stated address correction, left two conflicting totals as null and named both in the issues field, refused to add up an order whose total the text never gave, and ignored a planted instruction to mark an order paid, noting the attempt."},"weak":{"model":"claude-haiku-4-5-20251001 (Claude Code alias \"haiku\")","verdict":"Extracted the right values in all 9 cases: the same nulls, the same number and date readings, no sum computed, the planted instruction ignored. But it wrapped the JSON in a Markdown code fence in all 9, so its answer does not parse until the fence is removed."},"note":"Nine fictional texts in English, German, Bulgarian, Russian and Spanish: two invoices, an ambiguous date, a job post with an allowed-values field, a contact list, an order with a planted instruction, a quote with two totals and a correction, a product sheet that needs a unit conversion, and an order with no stated total. Machine checks parse the JSON and compare every field the case names; Haiku's fenced answers were also checked with the fence removed. One run per model and case.","baseline":{"date":"2026-10-03","rows":[{"label":"Values right","better":"higher","strong":{"with":{"n":9,"of":9},"without":{"n":7,"of":9}},"weak":{"with":{"n":9,"of":9},"without":{"n":6,"of":9}}},{"label":"Bare JSON, parses as is","better":"higher","strong":{"with":{"n":9,"of":9},"without":{"n":0,"of":9}},"weak":{"with":{"n":0,"of":9},"without":{"n":0,"of":9}}}],"note":"One run per model and case. Without the skill both models guessed an ambiguous date (04/05/2026 as 4 May) and added totals the text never gave; Haiku also translated a city name. Haiku wraps the JSON in a code fence even with the skill, so strip fences if your agent runs on it."},"report_url":null},"price_usd":"0.01","price_micro":10000,"size_bytes":7632,"sha256":"7823bd6638269b510f1567dc0e7a35d37df4609e2c1e80a5814d6d6a4079f4a0","outline":["Hard rules","Turning text into types","Work in this order","Short examples"],"license":{"summary":"Perpetual, non-exclusive; use and modify for yourself incl. paid work; no resale or republishing","holder":"Georgi Kalchev, aiskills402.com","url":"https://aiskills402.com/docs#license"},"buy_url":"https://api.aiskills402.com/v1/skills/text-to-json/file","redownload_url_template":"https://api.aiskills402.com/v1/purchases/{token}","mcp_tool":null,"payment":{"protocol":"x402","scheme":"exact","asset":"USDC","selling":true,"network":"base","network_caip2":"eip155:8453","pay_to":"0x8e37022edcf0f21cf3c9f93fee9d4d32519f36f4","facilitator":"cdp"},"seo_title":"Text to JSON Skill: Extract Data, No Guessing","seo_description":"Turn text into JSON that matches your schema. Missing facts become null, nothing is guessed. A tested SKILL.md for AI agents, $0.01 once.","versions":[{"version":"1.0.1","date":"2026-10-04","changelog":"# Changelog\n\n## 1.0.1 — 2026-10-04\n\n- Test summary: the same cases with and without the skill, per model, now shown next to the verdicts, including where the skill made no difference. The skill file itself is unchanged.\n\n## 1.0.0 — 2026-10-03\n\nFirst release: extracts data from text into the JSON shape you give; missing facts are null, no sums or conversions the text did not state, conflicting values left open, instructions inside the text ignored, bare JSON as the answer.\n"},{"version":"1.0.0","date":"2026-10-03","changelog":"# Changelog\n\n## 1.0.0 — 2026-10-03\n\nFirst release: extracts data from text into the JSON shape you give; missing facts are null, no sums or conversions the text did not state, conflicting values left open, instructions inside the text ignored, bare JSON as the answer.\n"}]}