Skip to content

ISA not found #32

Description

@denniselit

Hi,

Im fairly new to EDI and tries to convert an EDIFACT message to json or XML with EdiEngine, however the files I receives does not start with ISA (since it's EDIFACT and not X12 i think?).

Is there a way to work around or fix this with EdiEngine?

The structure in the files I receive looks like this (https://learn.microsoft.com/en-us/biztalk/core/edi-headers-and-trailers):

UNA Service String Advice  
UNB Interchange Control Header  
  UNG Functional Group Header  
    UNH Message Header  
    UNT Message Trailer  
  UNE Functional Group Trailer  
UNZ Interchange Control Trailer

Code:

        var edi = File.ReadAllText(path);
        EdiDataReader r = new EdiDataReader();
        EdiBatch b = r.FromString(edi.Trim());

        //Serialize the whole batch to JSON
        JsonDataWriter w1 = new JsonDataWriter();
        string json = w1.WriteToString(b);

        //OR Serialize selected EDI message to Json
        string jsonTrans = JsonConvert.SerializeObject(b.Interchanges[0].Groups[0].Transactions[0]);
        
        //Serialize the whole batch to XML
        XmlDataWriter w2 = new XmlDataWriter();
        string xml = w2.WriteToString(b);

Best regards!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions