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: 

/UI2/CL_JSON v/s XCO Library Class XCO_CP_JSON - Recommended Approach for ABAP on Cloud

satish_inamdar
Explorer
0 Kudos
741

Hi Experts,

When it comes to ABAP on Cloud (Steampunk) what is the recommended approach to work with JSON data (Serialisation, Deserialisation). The Classic Class: /UI2/CL_JSON is a released API even in the latest version (2308) but at the same time XCO library is also available for developers to deal with JSON data.

Please note: /UI2/CL_DATA_ACCESS class is not a released API (not sure why)

So, what is the general recommendation/best practice from SAP for working with JSON data in ABAP on SAP BTP Environment.

3 REPLIES 3

nathanbaes
Explorer
413

I have explored both XCO library and /UI2/CL_JSON, and I find both have important limitations.   /UI2/CL_JSON has not been updated to support pascal case, so any JSON integration requiring pascal case cannot utilize that class.  XCO supports pascal, but unlike /UI2/CL_JSON it doesn't support compression.  Therefore, every element is filled with a blank value.

In the case below if we have a structure with three elements, and in that structure Phone is blank, XCO passes Phone with a blank value.  I need an option that skips elements, arrays, etc. that are all blank values.

{
    "Person": {
        "Name": "Jim Smith",
        "Email": "jim@email.com",
        "Phone": ""
    }
}
 
I'd ask that XCO be updated to support compression so I can use that moving forward.

0 Kudos
176

Thanks for highlighting the differences that you have observed. It is helpful

LeonvNiekerk
Explorer
0 Kudos
96

/UI2/CL_JSON does support pascal case since new release.

Even in older versions, you could use pascal by starting the field names with underscore, but is not ideal