EDI to Json

1,048 views
Skip to first unread message

rekha p

unread,
Jul 14, 2022, 12:43:33 AM7/14/22
to Smooks Users
Hello, 

I am totally new to the EDI space and joined a project where I have to convert EDI to Json msg, for now I am starting with EDI 990 type.

can you please share an example for this usecase ? the one I referred is very old, I am not sure if it would work  - https://github.com/smooks/smooks/blob/v1.7.1/smooks-examples/edi-to-java/src/main/java/example/edi-to-java-order-mapping.xml 

couple of questions I have,
1. My company doesnot have any EDI schemas, so do I have to create one from the Json object structure?
2. The EDI file contains multiple EDI transactions in it, can smooks handle the split by itself. 

Thanks,
Rekha

 

Claude Mamo

unread,
Jul 14, 2022, 5:29:01 AM7/14/22
to smook...@googlegroups.com
Greetings Rekha,

I am totally new to the EDI space and joined a project where I have to convert EDI to Json msg

Out-of-the-box, Smooks doesn't have a JSON visitor but you can easily implement one that serialises EDI events to JSON.

can you please share an example for this usecase ? the one I referred is very old, I am not sure if it would work

Smooks's EDI and EDIFACT functionality was completely overhauled in Smooks 2 so I suggest you view the examples for Smooks 2.0.0-RC1.

1. My company doesnot have any EDI schemas, so do I have to create one from the Json object structure?

It depends. EDI has many flavours, therefore, generally speaking, the developer needs to author or generate the DFDL schemas for reading and writing EDI. However, for EDIFACT, DFDL schemas were generated from the EDIFACT directories ahead of time so you can leverage these schemas to read and write EDIFACT. However, I suspect you're on EDI X12. If that's the case, depending on the number of message types and versions that need to be supported, it might be worth to consider generating the DFDL schemas from the X12 implementation guidelines.

2. The EDI file contains multiple EDI transactions in it, can smooks handle the split by itself.

Indeed and this is one aspect where Smooks shines. You can route, efficiently, different parts of the document, not just transaction sets, to different endpoints with Smooks resources called visitors. The documentation site and the examples repo are great places to begin learning Smooks fundamentals.

Claude

--
You received this message because you are subscribed to the Google Groups "Smooks Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to smooks-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/smooks-user/83acd230-8066-4dce-9991-76d4d68b9f41n%40googlegroups.com.

rekha p

unread,
Jul 20, 2022, 12:33:39 AM7/20/22
to Smooks Users
Thanks Claude, I will go through these links.

rekha p

unread,
Jul 27, 2022, 10:13:37 AM7/27/22
to Smooks Users
@Claude, Hello,

I have the XSD created for the EDI to XML conversion, however the smooks mapper exits the mapping process whenever there is a mandatory element(minOccurs=1) is missing in the EDI input. But in my usecase it should log the error and continue the mapping because the EDI file has succeeding ST transaction sets that needs to be processed as well. any guidance on this would be helpful.

Thanks,
Rekha
Reply all
Reply to author
Forward
0 new messages