[ABAP] ABAPJSON Serializer / Deserializer

SELECT * FROM sflight INTO TABLE @DATA(it_flight).

* ABAP->JSON
DATA(lv_json) = /ui2/cl_json=>serialize( data = it_flight
                                         compress = abap_true
                                         pretty_name = /ui2/cl_json=>pretty_mode-camel_case ).

WRITE: / lv_json.

DATA: it_flight_json TYPE STANDARD TABLE OF sflight WITH DEFAULT KEY.

* JSON->ABAP
/ui2/cl_json=>deserialize( EXPORTING
                             json = lv_json
                             pretty_name = /ui2/cl_json=>pretty_mode-camel_case
                           CHANGING
                             data = it_flight_json ).

* ABAP object ->JSON
DATA(o_descr) = cl_abap_typedescr=>describe_by_data( it_flight_json ).
DATA(lv_json2) = /ui2/cl_json=>serialize( o_descr ).

WRITE: / lv_json2.

Weiterführende Infos: Link