DATA: LV_CONVERT TYPE STRING,
LO_JSON_SER TYPE REF TO CL_TREX_JSON_SERIALIZER,
LV_ERR_TEXT TYPE STRING.
DATA: LV_JSON TYPE STRING.
* 將JSON轉換為HTML
CALL TRANSFORMATION SJSON2HTML SOURCE XML LV_JSON
RESULT XML DATA(LV_HTML).
CATCH CX_XSLT_RUNTIME_ERROR INTO DATA(LO_ERR).
LV_ERR_TEXT = LO_ERR->GET_TEXT( ).
WRITE: LV_ERR_TEXT.
RETURN.
ENDTRY.
* 顯示HTML
LV_CONVERT = CL_ABAP_CODEPAGE=>CONVERT_FROM( LV_HTML ).
CL_ABAP_BROWSER=>SHOW_HTML( HTML_STRING = LV_CONVERT ).