Skip to main content

X12

An X12 file is a run of segments, each ending with ~, named by its first element: ISA, ST, BEG, PO1. Elements are split by *, and components by ::

PO1*1*10*EA*9.95**VP*A100~

The ISA segment that starts every file says which separators it uses, so the builder reads them from there. Its fields are padded to set lengths, blank ones too, and the builder keeps those widths, so the file writes back the same.

Tell Crosswalk how to read it​

To read a file, Crosswalk needs its schema: the name and type of each field, and which ones are lists. The builder below makes one from an example, and shows the JSON it reads as you go. When it reads the example the way you want, the Schema tab has the schema to use in a map.

  1. Pick a segment by clicking its tag at the start of any of its lines.
  2. Name its elements. Click one on any of its lines, and name it and set its type in the bar under the lines. A price such as 19.50 stays text, so it's written back with its zero.
  3. Name the segment above the lines. The dropdown beside each tag says whether it reads as one record or a list: one BEG is a record, and the PO1 segments are a list.
Sample 10 lines, CSV: ISA*00* *00* *…

Paste a few lines of your own file to make a schema for it; the layout is worked out from what you paste.

Lines
ISA lines are calledClick a tag on the left to work on other lines.
*00* *00* *ZZ*SENDER *ZZ*RECEIVER *260302*1200*^*00501*000000001*0*P*:
*PO*SENDER*RECEIVER*20260302*1200*1*X*005010
*850*0001
*00*SA*PO-1001*·*20260302
*1*10*EA*9.95*·*VP*A100
*2*5*EA*19.50*·*VP*B200
*2
*6*0001
*1*1
*1*000000001
Click a field or a part of one to name it. Shift-click another field to select the fields between, to make a list of them.
Writes the sample back as it was.
{
"isa": {
"field1": "00",
"field3": "00",
"field5": "ZZ",
"field6": "SENDER",
"field7": "ZZ",
"field8": "RECEIVER",
"field9": 260302,
"field10": 1200,
"field11": "^",
"field12": "00501",
"field13": "000000001",
"field14": 0,
"field15": "P",
"field16": ":"
},
"gs": {
"field1": "PO",
"field2": "SENDER",
"field3": "RECEIVER",
"field4": "20260302",
"field5": 1200,
"field6": 1,
"field7": "X",
"field8": "005010"
},
"st": {
"field1": 850,
"field2": "0001"
},
"beg": {
"field1": "00",
"field2": "SA",
"field3": "PO-1001",
"field5": "20260302"
},
"po1": [
{
"field1": 1,
"field2": 10,
"field3": "EA",
"field4": "9.95",
"field6": "VP",
"field7": "A100"
},
{
"field1": 2,
"field2": 5,
"field3": "EA",
"field4": "19.50",
"field6": "VP",
"field7": "B200"
}
],
"ctt": {
"field1": 2
},
"se": {
"field1": 6,
"field2": "0001"
},
"ge": {
"field1": 1,
"field2": 1
},
"iea": {
"field1": 1,
"field2": "000000001"
}
}

Every setting is in the EDI section of the flat files reference.