Convert between EDI and JSON Last updated: 2026-09-30
ediFabric .NET, ediFabric Native and ediFabric Cloud all convert EDI to JSON and JSON back to EDI. Every property name in that JSON comes from an EDI model: the machine-readable form of the implementation guide. This page uses the HIPAA 5010 professional claim, 837P (005010X222A1), to show that model and where each product's example lives.
EDI models
A model states which loops, segments and data elements a transaction contains, the order they appear in, and which of them are required. ediFabric reads that model when it parses EDI into objects or JSON, when it validates, and when it generates EDI from those objects or from JSON. EDI models is how that model is written in C# and in OpenEDI, and how you change it to match a partner file.
The same model is published three ways:
| Form | Used by | What you open |
|---|---|---|
| ediFabric EDI template | ediFabric .NET | C# classes. Property names are the JSON names. |
| OpenEDI | ediFabric Cloud, and the source you edit | An OpenAPI 3 schema with x-openedi-* extensions. |
| ediFabric Native file | ediFabric Native | The intermediary JSON the native engine loads. You download it; you do not author it. |
Every standard model is in the EDI spec library. Open HIPAA 5010 837P, then use Download in the JSON view:
- As OpenEDI JSON saves
en-837P-openedi.json, the OpenAPI definition. - As ediFabric Native saves
en-837P-efnative.json, the intermediary file ediFabric Native loads at runtime.
The .NET template for this claim is the C# in EdiFabric.Examples.X12.T837P.DB. EF_HIPAA_005010_837P.cs is the transaction. EF_HIPAA_005010_Segments.cs is the segments. The class is TS837P in the namespace EdiFabric.Templates.Hipaa5010.
How the model is represented
These three excerpts are the start of the same 837P. The template properties and the OpenEDI properties are the names in the JSON you get back. The Native file is the layout the engine loads.
ediFabric EDI template
.NET templates are C# classes marked with ediFabric attributes. EDI templates explains how the reader loads them. The 837P message class from the example project:
/// <summary>
/// Health Care Claim : Professional
/// </summary>
[Serializable()]
[DataContract()]
[Message("X12", "005010X222A1", "837")]
public class TS837P : EdiMessage
{
[DataMember]
[Pos(1)]
public virtual ST ST { get; set; }
[DataMember]
[Required]
[Pos(2)]
public virtual BHT_BeginningOfHierarchicalTransaction_8 BHT_BeginningOfHierarchicalTransaction { get; set; }
[DataMember]
[Required]
[Pos(3)]
public virtual All_NM1_837P_6 AllNM1 { get; set; }
[DataMember]
[Required]
[Pos(4)]
public virtual List<Loop_2000A_837P> Loop2000A { get; set; }
[DataMember]
[Pos(5)]
public virtual SE SE { get; set; }
}A segment class names each element. This is BHT from EF_HIPAA_005010_Segments.cs. Element 1005 is the property HierarchicalStructureCode_01:
[Segment("BHT")]
public class BHT_BeginningOfHierarchicalTransaction_8 : BHT, I_BHT
{
[DataMember]
[Required]
[DataElement("1005", typeof(X12_ID_1005_5))]
[Pos(1)]
public string HierarchicalStructureCode_01 { get; set; }
[DataMember]
[Required]
[StringLength(1, 50)]
[DataElement("127", typeof(X12_AN))]
[Pos(3)]
public string SubmitterTransactionIdentifier_03 { get; set; }
}OpenEDI
OpenEDI is that same layout as an OpenAPI schema. OpenEDI format defines the x-openedi-* extensions. From en-837P-openedi.json:
{
"TS837P": {
"type": "object",
"x-openedi-message-id": "837",
"x-openedi-message-standard": "X12",
"x-openedi-message-version": "005010X222A1",
"properties": {
"ST": { "$ref": "#/components/schemas/ST" },
"BHT_BeginningOfHierarchicalTransaction": { "$ref": "#/components/schemas/BHT_BeginningOfHierarchicalTransaction_8" },
"AllNM1": { "$ref": "#/components/schemas/All_NM1_837P_6" },
"Loop2000A": { "type": "array", "items": { "$ref": "#/components/schemas/Loop_2000A_837P" } },
"SE": { "$ref": "#/components/schemas/SE" }
}
}
}The ST segment and one BHT element:
{
"ST": {
"type": "object",
"x-openedi-segment-id": "ST",
"required": ["TransactionSetControlNumber_02", "TransactionSetIdentifierCode_01"],
"properties": {
"TransactionSetIdentifierCode_01": {
"type": "string",
"minLength": 3,
"maxLength": 3,
"x-openedi-element-id": "143"
}
}
},
"BHT_BeginningOfHierarchicalTransaction_8": {
"type": "object",
"x-openedi-segment-id": "BHT",
"properties": {
"HierarchicalStructureCode_01": { "type": "string", "x-openedi-element-id": "1005" },
"SubmitterTransactionIdentifier_03": {
"type": "string",
"format": "X12_AN",
"minLength": 1,
"maxLength": 50,
"x-openedi-element-id": "127"
}
}
}
}ediFabric Native intermediary
ediFabric Native does not read the C# template or the OpenEDI file. Download As ediFabric Native and pass that file to set_map. The file is a compiled layout: Messages, Segments, Groups, Elements, Composites, Codes, Terms and Rules. Your application does not parse this file. The library does. The 837P message entry in en-837P-efnative.json:
{
"Messages": {
"837P_EdiNation.X12.HIPAA.005010": {
"Format": "X12",
"Model": "EdiNation.X12.HIPAA.005010",
"Type": "837P",
"Version": "005010X222A1"
}
}
}The JSON you get back
Parsing an 837P produces JSON whose property names are the template properties and the OpenEDI schema properties. ST element 143 is TransactionSetIdentifierCode_01 because that is the name in the EDI template and in the OpenEDI schema. This is the start of a professional claim:
{
"ST": {
"TransactionSetIdentifierCode_01": "837",
"TransactionSetControlNumber_02": "0021",
"ImplementationConventionPreference_03": "005010X222A1"
},
"BHT_BeginningOfHierarchicalTransaction": {
"HierarchicalStructureCode_01": "0019",
"TransactionSetPurposeCode_02": "00",
"SubmitterTransactionIdentifier_03": "244579",
"TransactionSetCreationDate_04": "20061015",
"TransactionSetCreationTime_05": "1023",
"TransactionTypeCode_06": "CH"
}
}The full claim, including loops 1000, 2000 and 2400, is on the 837P transaction page. To generate EDI, send JSON in this shape back to the same product.
.NET returns this JSON by serializing a TS837P object. Native parse returns the transaction JSON directly. Cloud /x12/read returns an X12Interchange array, and the transaction object inside Groups[].Transactions uses these same names, plus "Model": "EdiNation.X12.HIPAA.005010".
ediFabric .NET
Read the file into a TS837P object with X12Reader, then serialize that object with the JSON serializer you already use. Deserialize JSON back into TS837P and write it with X12Writer. The steps, for an 850 and the same pattern for 837P, are in Convert between EDI and JSON.
Install EdiFabric and EdiFabric.Templates.Hipaa, or compile the C# from EdiFabric.Examples.X12.T837P.DB. A full 837P program is in the 837P transaction example.
ediFabric Native
Load en-837P-efnative.json with set_map, then call parse to get transaction JSON and build to turn that JSON back into X12. The Python, Java and C calls are in Convert between EDI and JSON for ediFabric Native.
ediFabric Cloud
POST the EDI file to https://api.edination.com/v2/x12/read. The 837P transaction in the response follows the OpenEDI model EdiNation.X12.HIPAA.005010. POST one interchange back to /x12/write. The 837P calls are in Convert between EDI and JSON for ediFabric Cloud. Every standard's read and write URL is in Convert between EDI and JSON.
