PackagePackagetypeA library you install and call yourself.See every one →What this type is →independently maintainedindependently maintainedoriginPublished by one person or a small company outside SAP. Says nothing about quality; the readings say that.See every one →

ABAP JSON API

A JSON renderer and parser for ABAP built on the standard identity transformation, adding automatic camelCase conversion and support for polymorphic arrays.

ZCL_JSON renders ABAP data to JSON and parses it back through the standard identity transformation, and adds what that transformation alone leaves out: automatic camelCase to CAMEL_CASE conversion of property names, suppression of initial components, and conversion rules of your own. Rendering and parsing run through data references, so it can also build a table of ref to data whose lines are each of a different ABAP type, which an ordinary internal table cannot express. The maintainer wrote it after working through the ways ABAP already offers — the identity transformation, the sXML library, /UI2/CL_JSON and XCO_CP_JSON — and compares their features and speed in a separate benchmark project. It depends on codepage and on ZCL_ABAP_CASE, two more libraries by abapify.

Facts

Last pushLicenceMIT

Where it sits

Lives in
Provides
SerialisationABAPSerialisationcapabilityTurning typed in-memory data into a text or binary format such as JSON, CSV or protobuf and reading it back, including the mapping of names and types the language does not do for you. The protocol that carries the payload is a separate concern: an HTTP or OData client moves the bytes, and serialisation decides what they say.
Requires
codepagecodepageartifactone of the two libraries the README lists under Dependencies, beside ZCL_ABAP_CASE; the test dependencies are listed separately

Who is behind it

abapifyabapifyOrganisationMaintains this
In the atlas: maintains 9
@abapify
maintainerPetr PlenkovPersonContributes to this
In the atlas: contributes to 13
@ThePlenkov
1 contributor

What it declares

Every artifact

Type
Package
Origin
Independently maintained

As a package

Where it runs
does not say
Distributed through
does not say

Connections2

README

quoted from abapify/json under MIT, read
abapify/json/README.mdOn GitHub

ABAP JSON API

Why?

We know at least following ways to serialize/deserialize JSON in ABAP:

MethodFeatures
Identity Transformation (CALL TRANSFORMATION JSON)✅ Standard SAP approach
✅ Very fast
✅ Supports deep structures
❌ Limited functionality
sXML Library (cl_sxml_string_writer, cl_sxml_parser)✅ Fine-grained control over parsing/rendering
✅ Handles large JSON streams efficiently
✅ Supports custom serialization logic
❌ Requires manual parsing and handling of JSON nodes
❌ More complex to implement compared to other methods
/UI2/CL_JSON (or Z_UI2_JSON)✅ Easy to use, with automatic conversion
✅ Supports deep and complex structures
✅ Open-source alternative available (Z_UI2_JSON)
✅ So far fastest JSON parser and rendered after identity transformation
XCO_CP_JSON (xco_cp_json)✅ Modern, officially supported API for Cloud
✅ Ability to apply own transformations
❌ Not available in older on-premise systems
❌ Enormously slow
❌ Dumps on data refs

Here you can find a very good article about some of these methods

Unfortunately I was not please with any of approaches and decided to create an own library implementing following features:

  • Using standard identity transformation supporting all available types mapping automatically
  • Automatic camelCase <-> CAMEL_CASE conversion for property names
  • Suppress initital components ( feature of identity transformation )
  • Allowing to use own conversion rules
Performance benchmark

You can find more details and data in JSON benchmark project where we analyse different libs, their features and compare performance. Feel free to contribute!

ZCL_JSON

Render JSON
" render binary
data(json_binary) = zcl_json=>render( your_any_variable )
" or stringify (same but as string)
data(json_string) = zcl_json=>stringify( your_any_variable )
Parse JSON
" Parsing requires two steps
zcl_json=>parse( json_binary_or_string )->to( ref #(  your_data_variable ) ).
Support data refs

It's possible to create JSON from data references

" render binary
data(json_binary) = zcl_json=>render( value payload_type( ref_to_data = new any_type( some_values = .. ) ) )
Support polymorphic arrays

By default ABAP internal tables do not support polymorphism or union types. You need to normalize type and build type including all elements. However in a modern world JSON schemas can use such constructions as oneOf, anyOf and etc. As a result of data refs support we can also support table of ref to data which allows us to build arrays where every line may be of a different type.

 TYPES:
   BEGIN OF abap_bool_ts,
    true TYPE abap_bool,
   END OF abap_bool_ts,
   BEGIN OF xsdboolean_ts,
    true TYPE xsdboolean,
   END OF xsdboolean_ts, 
   BEGIN OF root_ts,
     array_of_ref_to_data TYPE TABLE of REF TO data WITH EMPTY KEY,
   END OF root_ts.

TRY.   
      out->write(
        name = 'Polymorphic array'
        data = zcl_json=>stringify(
            VALUE root_ts(
                array_of_ref_to_data = value #(
                    ( new abap_bool_ts(  true = abap_true ) )
                    ( new xsdboolean_ts( true = abap_true ) )
                    ) ) ) ).

     CATCH cx_static_check.
       "handle exception
   ENDTRY.

will print

{"arrayOfRefToData":[{"true":"X"},{"true":true}]}

Dependencies

Test Dependencies

MIT, read
Serialisation
  1. zcl_mdp_jsonABAP library generating and parsing JSON stringsfrom ABAP
  2. JSON2ABAPTypeGenerator of ABAP type definitions from JSON structuresfrom ABAP
  3. abap-protobufProtocol Buffers (proto2) implementation in ABAPfrom ABAP
  4. ZASISRegex RuleSets that read barcode strings into named fieldsfrom ABAP
  5. ABAP ArchitectEclipse plug-in turning JSON or XML into ABAP types and DDIC objectsfrom ABAP
  6. ABAP to JSON serializer and deserializerOpen-source Z* version of /UI2/CL_JSON for ABAP to JSONfrom ABAP
  7. ajsonJSON parser and serialiser for ABAP with a node treefrom ABAP
  8. sbcgua/text2tabParser of TAB-delimited text into ABAP internal tables and backfrom ABAP
  9. ABAP JSON Encoder/DecoderJSON encoder and decoder for ABAP, modelled on Go's encoding/jsonfrom ABAP
  10. ZwdCSVRFC 4180 CSV parser and generator for ABAPfrom ABAP
  11. ABAP CSV ManagerConfigurable CSV reader and writer for ABAPfrom ABAP

Details

Sources3
Added by handdiscovered herechecked
github.com/abapify/jsontree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
discovered viaAdded by hand
first seen in the atlas
ecosystem and domainabap, protocols-and-apis
abaplint
issues under its own abaplint configuration0
lines352
statements164
objects5
files6
analysed, main
abaplint version2.120.84
Contributors1

From the repository’s contributor list, .

History in the atlas1
  1. First seen.
For your agent