ABAP JSON转换
Posted 学习笔记
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ABAP JSON转换相关的知识,希望对你有一定的参考价值。
REPORT ztest_json. DATA: json_ser TYPE REF TO cl_trex_json_serializer, json_des TYPE REF TO zcl_trex_json_deserializer. TYPES:BEGIN OF zsml, functionname(30), bcpcode(30), status(1), msg(256), result(1024), END OF zsml. DATA ls_json TYPE zsml. DATA lt_json TYPE TABLE OF zsml. DATA lv_json TYPE string. * 设置报文内容(json格式字符串) ls_json-functionname = ‘XXXXXX‘. ls_json-bcpcode = ‘20170214000000‘. ls_json-status = ‘S‘. ls_json-msg = ‘请调用接口抓取数据‘. ls_json-result = ‘‘. APPEND ls_json TO lt_json. * 内表->JSON CREATE OBJECT json_ser EXPORTING DATA = lt_json[]. CALL METHOD json_ser->serialize. CALL METHOD json_ser->get_data RECEIVING rval = lv_json. *JSON->内表 CREATE OBJECT json_des. CLEAR lt_json. CALL METHOD json_des->deserialize EXPORTING json = lv_json IMPORTING abap = lt_json[].
以上是关于ABAP JSON转换的主要内容,如果未能解决你的问题,请参考以下文章