provideplatform / provide-abap

Open-source implementation of the PRVD Stack baseline middleware pattern for SAP, using ABAP
Apache License 2.0
8 stars 2 forks source link

Sanitize JSON output to enforce snake case and empty string -> null conversions #40

Open kthomas opened 2 years ago

fleischr commented 2 years ago

We need to take into consideration how SAP asserts data types

Based on the data type - null isn't an acceptable value to represent the data and the empty string is at times more appropriate

fleischr commented 2 years ago

JSON property names in the idoc formatted json is limited to 30 chars due to a limitation in dynamic data type construction. We'll need to limit remove underscores unless absolutely necessary to uniquely identify the segment

fleischr commented 1 year ago

Let's investigate our goto approach to JSON serialization in ABAP due to limitations in the /UI2/JSON library

fleischr commented 1 year ago

Best way to move forward based on my research ought to be the AJSON library. Had the clearest docs on how to control the serialization behavior.

Will seek to use it for upcoming standalone project

fleischr commented 1 year ago

Creating a public static method in the API helper class to manage this globally throughout the project. Default implementation will use the existing /UI2/ namespaced solution with params to switch to alternate means to serialize JSON through other libraries where appropriate