EDI to JSON Converter
Convert ANSI ASC X12 and UN/EDIFACT EDI documents into structured JSON objects and arrays for fast software integration.
Client-Side Execution & Privacy Guarantee
This utility executes 100% locally in your web browser. Your inputs, tokens, queries, and data payloads are never transmitted to any external server or backend.
EDI documents encode business data as delimited text. Converting them to JSON turns the hierarchical structure into objects and arrays that most modern languages and APIs already understand. An X12 interchange becomes an object with interchange, groups, and transactions arrays; each segment becomes an object whose keys are the element positions or standard names. EDIFACT follows the same pattern using its own segment tags and composites.
The converter parses the raw text locally, respects the delimiters declared in the ISA or UNA, and emits clean JSON. No document is uploaded. The resulting JSON can be consumed by REST endpoints, message queues, or mapping layers without requiring a full EDI translator.
X12 Hierarchy in JSON
The root object contains an interchange section that mirrors the ISA and IEA. Inside it, a groups array holds one object per GS/GE pair. Each group contains a transactions array; each transaction contains the ST/SE pair and an array of segment objects. A segment object uses keys such as BEG01, BEG03, or the conventional name when unambiguous.
Loops become nested arrays. Multiple PO1 segments appear as an array of objects, each optionally containing child PID or N1 objects. Control numbers and counts are preserved so the JSON remains reconcilable with the original document.
EDIFACT Hierarchy in JSON
An EDIFACT interchange becomes an object with a UNB section and a messages array. Each message contains the UNH, an array of data segments, and the UNT. Composites are represented as objects or arrays according to the number of components. For example a DTM composite 137:20240101:102 becomes an object with qualifier, date, and format.
The converter uses the separators declared in the UNA when present, or the standard + : ' defaults otherwise. Release characters are unescaped in the JSON values.
Output Options and Fidelity
You can choose compact or pretty-printed JSON. Element keys may be position-based (PO102) or name-based when the standard name is unambiguous. Empty elements are omitted or included as null according to the selected option, so downstream code can distinguish missing from present-but-blank.
The conversion is lossless for the data values; original spacing inside elements is preserved. Envelope control numbers remain available for correlation with acknowledgments.
When to use this tool
- You need to feed an EDI document into a JSON-based API or microservice.
- You are building a mapping or transformation layer and want a structured intermediate format.
- You want to inspect the logical hierarchy without writing a custom parser.
- You are integrating with systems that do not have an EDI translator but can consume JSON.
- You need a quick, private conversion for testing or debugging.
How to use the EDI to JSON Converter
- Paste the raw X12 or EDIFACT text into the input area.
- Select the output style (pretty or compact) and key style (position or name).
- Click Convert. The JSON appears in the output pane.
- Copy the JSON or download it as a file.
- For multi-transaction interchanges, the groups and transactions arrays preserve order and control numbers.
- If the document uses non-standard delimiters, confirm they are declared in the ISA or UNA; the converter reads them automatically.
- Clear and paste a new document at any time.
Worked examples
Simple X12 850 to JSON
ISA*00* *00* *ZZ*SENDER *ZZ*RECEIVER *250101*1200*U*00401*000000001*0*P*>~GS*PO*SENDER*RECEIVER*20250101*1200*1*X*004010~ST*850*0001~BEG*00*SA*PO12345**20250101~SE*3*0001~GE*1*1~IEA*1*000000001~
{"interchange":{"ISA13":"000000001","sender":"SENDER","receiver":"RECEIVER"},"groups":[{"GS01":"PO","GS06":"1","transactions":[{"ST01":"850","ST02":"0001","segments":[{"tag":"BEG","BEG01":"00","BEG02":"SA","BEG03":"PO12345","BEG05":"20250101"}]}]}]}
Control numbers and the BEG values are preserved. Segment count is not required in the JSON because the structure is explicit.
EDIFACT ORDERS Fragment
UNB+UNOC:3+SENDER+RECEIVER+240101:1200+1'UNH+1+ORDERS:D:96A:UN'BGM+220+PO12345+9'UNT+3+1'UNZ+1+1'
{"UNB":{"syntax":"UNOC:3","sender":"SENDER","receiver":"RECEIVER","control":"1"},"messages":[{"UNH":{"reference":"1","type":"ORDERS","version":"D","release":"96A"},"segments":[{"tag":"BGM","BGM01":"220","BGM02":"PO12345","BGM03":"9"}]}]}
Composites are expanded. The UNT segment count matches the segments present.
Common mistakes and tips
- Verify delimiters in the ISA or UNA before converting; incorrect detection shifts all subsequent elements.
- Large repeating loops become large arrays; consider streaming or pagination in the consuming application.
- Preserve original control numbers in the JSON if you later need to generate a 997 or CONTRL.
- Name-based keys are convenient for common segments but position-based keys are unambiguous across versions.
- Empty elements omitted from the JSON cannot be distinguished from elements that were never sent; choose the null option when that distinction matters.
Frequently asked questions
Does the converter support both X12 and EDIFACT?
Yes. It detects the format and applies the appropriate delimiter and hierarchy rules.
Are implementation-guide constraints enforced?
No. The converter produces a structural JSON representation of the data that is present. Validation against a partner guide is a separate step.
Can I convert JSON back to EDI?
Use the companion JSON to EDI Converter, which expects a compatible structure and emits correctly counted X12 or EDIFACT.
What happens with binary or encrypted payloads?
The tool expects plain-text EDI. Encrypted or binary content must be decrypted before conversion.
Is the document uploaded?
No. Conversion runs entirely in the browser.