X12 to JSON Field Mapping
X12 is positional and JSON is named, so the converter decides what each position becomes. The output mirrors the envelope rather than flattening it, because flattening loses the grouping that tells you which line an address belongs to.
| X12 | JSON | Notes |
|---|---|---|
| ISA / IEA | interchange | Sender and receiver IDs with qualifiers, date as YYYY-MM-DD, time as HH:MM, control number, test or production |
| GS / GE | functionalGroups[] | Functional ID (PO, IN, SH), sender, receiver, date as YYYY-MM-DD, time, control number |
| ST / SE | transactions[] | type, typeName and controlNumber |
| 850 BEG / 810 BIG | purchaseOrder / invoice | Number, purpose, type and dates as YYYY-MM-DD |
| DTM | dates[] | qualifier, meaning (002 is Delivery requested) and date as YYYY-MM-DD. A DTM inside a line goes on that line |
| REF | references[] | qualifier, meaning (DP is Department number) and value. A REF inside an N1 loop goes on that party |
| ITD | terms[] | Terms type, basis date, discount percent and days, net days, as numbers |
| N1 loops (N1, N2, N3, N4, PER) | parties.shipTo, parties.billTo, ... | Every N1 loop, with its ID qualifier spelled out (UL is GLN). A second party of the same type becomes shipTo_2 |
| PO1 / IT1 with PID | lineItems[] | quantity and unitPrice as numbers, unit with unitName (CA is case), every qualifier/ID pair in productIds[], PID text as description |
| 850 TD5 | carrier | Transport mode, carrier code and routing |
| CTT | totals | lineItemCount and hashTotal as numbers |
| 810 TDS | totalAmount, totalAmountAsSent | TDS01 has two implied decimals: 33500 becomes totalAmount 335 and totalAmountAsSent "33500" |
| Any other segment | segments[] with elements[] | Each element keeps its position, empty ones included. Segments inside a line loop (PO4, SAC, SDQ) go in that line's segments[] |
Empty elements are kept on purpose. If a converter silently dropped them, PO107 would shift into PO106 and every downstream mapping would be off by one.
EDIFACT and TRADACOMS to JSON
Paste a UN/EDIFACT or TRADACOMS file and the converter switches to the EDIFACT reader. Each message comes back with a business summary (document number, dates, parties with GLNs, lines with GTINs, quantities and prices, totals) followed by every segment by tag, with composite elements as arrays. The EDIFACT viewer shows the same parse segment by segment.
For People, Not Code?
If you want to read a document rather than process it, the EDI translator writes it out in plain English, and the EDI viewer and validator checks it the way a trading partner's translator would. To build an 850 from a spreadsheet, use CSV to EDI, and to map an XML order onto an 850, see XML to EDI. Segment meanings for every transaction set are in the EDI transaction guides.