Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Validate JSON Data against JSON schema

axel_moschuering
Explorer

Dear Experts,

I am facing the Problem to convert ABAP-data (i.e. data stored in internal tables) to JSON Format. I found several blogs/tips etc. describing serialization/de-serialization so I am confident to find a solution here.

What I am lacking is a solution to validate the generated JSON-data against the given JSON schema.

I found some classes ( [/UI5/CL_JSON_SCHEMA_CHECKER] / [/UI5/IF_JSON_SCHEMA_CHECK_OBJ] ) which seem promising, but I have no clue how to use them...:-(. In short I am looking for a validator like

https://www.jsonschemavalidator.net/ - only in ABAP.

Can anybody offer some advice here ?

Thank you all an best wishes,

Axel

3 REPLIES 3

Sandra_Rossi
Active Contributor
0 Kudos

It has been asked many times, only SAP PI provides a scheme validation. Simply call an external tool to validate the JSON, from the ABAP program. Are you sure you want to validate the JSON, if your program doesn't have bugs, it should generate the JSON with a valid syntax; in fact don't you just need to install a tool on your laptop during the tests to check the JSON?

axel_moschuering
Explorer
0 Kudos

Hi Sandra,

thank you for your answer. Unfortunately calling an external tool is not an option. JSON data is generated in a Batch process and sent out.

Validating the data before it is send would be great plus. Of course, you are right, that if the programm has no bugs, everything should be fine...:-).

Best wishes,

Axel

Sandra_Rossi
Active Contributor
0 Kudos

Install the external JSON validation tool on the application server then, and call it from ABAP.