Skip to content
DoItJag

EDI to JSON Converter

Turn an ANSI X12 or UN/EDIFACT file into JSON that any program can read. Each element is keyed by its position, such as BEG03 or DTM01, and composite elements become arrays.

or drop a file here · .edi, .x12, .txt, .dat · up to 20 MB

Try an example:
Structure

About the EDI to JSON Converter

JSON is what most modern code, low-code platforms and databases expect, while EDI is what retailers, carriers and insurers still send. This converter bridges the two for ANSI X12 and UN/EDIFACT without needing a mapping file first, which makes it handy for prototypes, tests and quick look-ups.

Two shapes of output

  • Nested keeps the envelopes: an array of interchanges, each with its header, groups and trailer, and inside each group the messages with their type, version, control number and segments.
  • Flat is a simple list of segments in file order, which is easier to loop over.

Every segment becomes an object with tag, line and elements. Element keys are positional, so the third element of BEG is BEG03 and the first of DTM is DTM01. Composite elements turn into arrays and empty positions are skipped. With names switched on, segments and messages also get a readable name or typeName where an official list provides one.

Worked example

From the EDIFACT example, the date segment DTM+137:20261119:102' becomes:

{ "tag": "DTM", "name": "Date/time/period", "line": 1, "elements": { "DTM01": ["137", "20261119", "102"] } }

and the free-text segment with ?+ in it comes out with a plain plus sign, because release characters are removed.

Tips

  • The top of the output records the separators that were used, so the file can be rebuilt later.
  • Values stay as text. Leading zeros in IDs and quantities such as 004010 are preserved instead of being turned into numbers.
  • Element keys describe positions, not business meanings. Your own code decides that BEG03 is the order number for your partner.
  • If the file has envelope errors, a warning appears above the result; the JSON is still produced from what could be read.

To make the JSON easier on the eye, paste it into the JSON formatter, or use the EDI to CSV converter for a spreadsheet instead.

How to use EDI to JSON Converter

  1. Paste your EDI data, open a file, or load an example.
  2. Choose nested or flat JSON and whether to add segment names.
  3. Select Convert to JSON, check the result, then copy or download the .json file.

Privacy: how it works

Everything happens in your browser. Your text is not sent to any server.

Frequently asked questions

What does the JSON look like?

Nested output has interchanges, groups and messages, each with its segments. Every segment has its tag, its line number and an elements object such as {"BEG03": "PO-1001"}. Empty elements are left out.

Are composite elements and release characters handled?

Yes. Components become arrays, for example "DTM01": ["137", "20261119", "102"], and EDIFACT release characters are removed so ?+ becomes +.

Does it map to business fields like order number?

No. Keys are the standard element positions, not names from your partner’s guide. That keeps it accurate for any message type.