WIth Releases 7.02 and 7.03/7.31 (Kernelpatch 116) JSON is supported natively in ABAP by the following features:
- JSON-XML is a special XML format that enables JSON data to be described using an XML representation. A new format, IF_SXML=>CO_XT_JSON, has been added to the sXML Library, which enables to handle JSON using JSON-XML.
- The canonical JSON representation asJSON defines a mapping between ABAP types and JSON. This is used in serializations and deserializations using the identity transformation ID.
- JSON data can be specified in various forms as an XML source in the statement CALL TRANSFORMATION and a JSON writer can be specified as target. The identity transformation ID supports JSON by using asJSON.
Example:
DATA text TYPE string VALUE `Hello JSON, I'm ABAP!`.
DATA writer TYPE REF TO cl_sxml_string_writer.
DATA json TYPE xstring.
"ABAP to JSON
writer = cl_sxml_string_writer=>create( type = if_sxml=>co_xt_json ).
CALL TRANSFORMATION id SOURCE text = text
RESULT XML writer.
json = writer->get_output( ).
"JSON to ABAP
text = `{"TEXT":"Hello ABAP, I'm JSON!"}`.
CALL TRANSFORMATION id SOURCE XML text
RESULT text = text.
Addendum
Meanwhile, the documentation for ABAP and JSON is online. This blog is pointing to it.