Thunder Wiki for Thunder Suite, JSON Thunder & XML Thunder

How to Parse JSON Messages in COBOL

JSON messages embed a set of data in "objects" and "properties" contained in a single string. This can be a challenge for programs written in languages such as COBOL that store information in specific fields. To work with JSON messages, sophisticated parsing and string manipulation routines are required while maintaining context for the data contained in message nodes.

Consider the following trivial example for an JSON message:

The string processing logic to parse the above JSON objects and properties into COBOL fields is already advanced, but it will quickly grow in complexity for larger messages as you account for context, optional data and repeating structures.

So what are your options?

You can hand write the code to validate, parse, and create JSON messages.

This can be an expensive undertaking as it can take weeks or even months of development effort. Furthermore, this approach can be error prone as it requires deep understanding and expertise with JSON.

Even after the processing code is developed, the majority of the cost of the application life cycle is still to come. JSON message layouts will change as business requirements evolve, meaning that much of the JSON parsing and creation code will have to be redeveloped again and again.

You can preprocess the JSON with a generic parser.

Although faster than option 1, it can still take a significant effort to complete and you still have the risk of a major rewrite if a change occurs.

Preprocessing also introduces additional platforms and/or components, both of which increase application complexity.

JSON Thunder is designed specifically to address the challenges of working with JSON in COBOL applications. Using a model-driven development approach and JSON Thunder’s visual designer, the power is in the coder’s hands to create a mapping of COBOL program fields to JSON properties. This mapping – called a Handler Design – is then used to generate all of the COBOL source code needed to parse or create JSON. The code is generated as a callable program module that can be used in new or existing COBOL applications. There are no runtimes required! And, there is no rewriting, which minimizes the time investment and the risk of error.

JSON Thunder’s benefits include:* Faster time to market - modernize applications to parse and generate JSON using COBOL in hours, not days, weeks or even months.

Respond to changes quickly – implement new schema versions with minimal effort. Impress your internal or external business user by reacting quickly and efficiently to their ever changing requirements.

Keep focus on the business logic in your programs – not the complexities of JSON.