EDIFACT / X12 EDI to JSON Viewer and Envelope Checker
Parse EDIFACT and ANSI X12 interchanges to JSON, check envelopes and counts, build EDI from JSON and generate 997 / CONTRL acknowledgements.
Result
Press “Run” to see the result.
Send an interchange as edi, a file or a raw body. The standard is detected: UN/EDIFACT (UNA service string advice with custom separators and release character, UNB / UNG / UNH envelopes) or ANSI X12 (separators read from the fixed-width ISA, ISA / GS / ST envelopes, repetition separator). Each EDIFACT segment comes with its elements and components (release characters removed) and the segment name for common segments; each message gets its type (ORDERS, INVOIC, DESADV, IFTMIN, COPARN, CUSCAR…), version and BGM document number. X12 transaction sets get their type title (850, 810, 856, 997…) and positional element ids (BEG01, BEG02…).
Envelope checks: UNT / SE segment counts and references, UNZ / UNE / GE / IEA counts and control numbers, missing trailers. action=validate returns only the checks.
action=ack builds the acknowledgement for the received interchange: an X12 997 (AK1 / AK2 / AK5 / AK9 with accepted, partially accepted or rejected status and error codes) or an EDIFACT CONTRL (UCI / UCM with action codes 7 / 4 and syntax error codes 28 / 29). action=generate turns JSON into EDI: messages (EDIFACT) or transactions (X12) are wrapped with UNB / UNH / UNT / UNZ or ISA / GS / ST / SE / GE / IEA with correct counts and control numbers, or segments are serialised as given (with release-character escaping).
Use this in your code
curl -X POST "https://apibox.io.vn/v1/edi-parse" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"edi":"UNA:+.? '\''\nUNB+UNOC:3+5412345000013:14+4012345000016:14+261111:1200+00000001++ORDERS'\''\nUNH+1+ORDERS:D:96A:UN:EAN008'\''\nBGM+220+PO-2026-778+9'\''\nDTM+137:20261111:102'\''\nDTM+2:20261120:102'\''\nFTX+AAI+++Please deliver to dock 3?: before 10?+00'\''\nNAD+BY+5412345000013::9'\''\nNAD+SU+4012345000016::9'\''\nLIN+1++4000862141404:SRS'\''\nQTY+21:48'\''\nPRI+AAA:12.50'\''\nLIN+2++4000862141411:SRS'\''\nQTY+21:12'\''\nUNS+S'\''\nCNT+2:2'\''\nUNT+15+1'\''\nUNZ+1+00000001'\''\n"}'const res = await fetch('https://apibox.io.vn/v1/edi-parse', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"edi": "UNA:+.? '\nUNB+UNOC:3+5412345000013:14+4012345000016:14+261111:1200+00000001++ORDERS'\nUNH+1+ORDERS:D:96A:UN:EAN008'\nBGM+220+PO-2026-778+9'\nDTM+137:20261111:102'\nDTM+2:20261120:102'\nFTX+AAI+++Please deliver to dock 3?: before 10?+00'\nNAD+BY+5412345000013::9'\nNAD+SU+4012345000016::9'\nLIN+1++4000862141404:SRS'\nQTY+21:48'\nPRI+AAA:12.50'\nLIN+2++4000862141411:SRS'\nQTY+21:12'\nUNS+S'\nCNT+2:2'\nUNT+15+1'\nUNZ+1+00000001'\n"
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://apibox.io.vn/v1/edi-parse",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"edi": "UNA:+.? '\nUNB+UNOC:3+5412345000013:14+4012345000016:14+261111:1200+00000001++ORDERS'\nUNH+1+ORDERS:D:96A:UN:EAN008'\nBGM+220+PO-2026-778+9'\nDTM+137:20261111:102'\nDTM+2:20261120:102'\nFTX+AAI+++Please deliver to dock 3?: before 10?+00'\nNAD+BY+5412345000013::9'\nNAD+SU+4012345000016::9'\nLIN+1++4000862141404:SRS'\nQTY+21:48'\nPRI+AAA:12.50'\nLIN+2++4000862141411:SRS'\nQTY+21:12'\nUNS+S'\nCNT+2:2'\nUNT+15+1'\nUNZ+1+00000001'\n"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/edi-parse');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"edi":"UNA:+.? \'\\nUNB+UNOC:3+5412345000013:14+4012345000016:14+261111:1200+00000001++ORDERS\'\\nUNH+1+ORDERS:D:96A:UN:EAN008\'\\nBGM+220+PO-2026-778+9\'\\nDTM+137:20261111:102\'\\nDTM+2:20261120:102\'\\nFTX+AAI+++Please deliver to dock 3?: before 10?+00\'\\nNAD+BY+5412345000013::9\'\\nNAD+SU+4012345000016::9\'\\nLIN+1++4000862141404:SRS\'\\nQTY+21:48\'\\nPRI+AAA:12.50\'\\nLIN+2++4000862141411:SRS\'\\nQTY+21:12\'\\nUNS+S\'\\nCNT+2:2\'\\nUNT+15+1\'\\nUNZ+1+00000001\'\\n"}',
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));API documentation → Get a free API key
FAQ
Why are X12 elements named BEG01, BEG02…?
The X12 dictionary (element names and code lists) is licensed by X12. We give the positional ids; names come from your trading partner’s implementation guide.
Does it validate against a partner implementation guide?
No. It checks syntax and envelopes (counts, control numbers, trailers), not partner-specific segment requirements.
How large can a file be?
Up to your plan’s file size limit (max 20 MB of EDI text).