Over a million developers have joined DZone.

How to Create an EDI to JSON Transformation

Gordon Crenshaw offers a tutorial for converting legacy EDI data into JSON using various transformation tools and techniques.

· Integration Zone

Learn how API management supports better integration in Achieving Enterprise Agility with Microservices and API Management, brought to you in partnership with 3scale

With the exploding adoption of IoT and mobile applications, how do you handle all this data behind REST web services along with their expanded requirements?

How to Create an EDI to JSON TransformationFor years, Progress customers have been using XML Converters to bidirectionally convert EDI and flat-file data into XML documents and streams. As companies adopt and integrate with IoT, mobile devices, and data behind REST web services, their requirements have expanded, now requiring bi-directional conversion of EDI and flat-file data into JSON instead of XML.

How to Convert EDI and Flat-File Data Into JSON With XQuery and XML Converters

How can one do this with XQuery and the XML Converters? Let me show you using the following sample X12 270 5010 (real-time eligibility, coverage, or benefit requests) HIPAA document and Stylus Studio. 

How can one do this with XQuery and the XML Converters?

Using Stylus Studio’s XML Mapper functionality and the DataDirect XQuery engine, you’ve mapped your EDI data into the desired XML Schema (see below).

You’ve mapped your EDI data into the desired XML Schema

When you press the green preview button, you generate your desired XML output.

Your desired XML output

The DataDirect XQuery engine is seamlessly integrated with the XML Converters and can force the output into another supported format just by using one of the DataDirect XQuery functions. To generate the output as JSON data, write the following command at the beginning of your existing XQuery statement:

declare option ddtek:serialize “method=JSON”;


declare option ddtek:serialize “method=JSON”;

Re-run your XQuery statement by pressing the green preview button. You’ll see that the output has been converted to JSON based on the XML Schema defined.

The output has been converted to JSON based on the XML Schema defined

Now, your web clients, mobile applications or IoT devices are ready to support real-time eligibility, coverage or benefit requests with JSON.

Real-Time Access to XML Data

Get instant SQL connectivity from tabular and hierarchical-formatted XML documents with a single connector. Progress DataDirect enables you to connect to XML via ODBC, XML Converters, XQuery or XML editor. These solutions enable the easy integration of XML data with your application, along with the ability to quickly retrieve data from either a local file system, a web server, or a web service. You can try it now here. 

Unleash the power of your APIs with future-proof API management - Create your account and start your free trial today, brought to you in partnership with 3scale.

integration ,edi ,json ,xml

Published at DZone with permission of Gordon Crenshaw. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}