ABAP 把数据转JSON文本

ABAP 把数据转JSON文本

 


data serializer type ref to cl_trex_json_serializer.

types: begin of type_s1,
        key  type string,
        value type string,
      end of type_s1.

data lt_json type table of type_s1.
data ls_json type type_s1.

ls_json-key = 'country'.
ls_json-value = 'cn'.
APPEND ls_json to lt_json.

ls_json-key = 'QA'.
ls_json-value = '1000'.
APPEND ls_json to lt_json.

ls_json-key = 'BS'.
ls_json-value = '2000'.
APPEND ls_json to lt_json.

ls_json-key = 'PS'.
ls_json-value = '3000'.
APPEND ls_json to lt_json.

ls_json-key = 'GA'.
ls_json-value = '4000'.
APPEND ls_json to lt_json.

create object serializer
  exporting
    data = lt_json.

serializer->serialize( ).

write: / serializer->get_data( ).

 

上一篇:C# 文本框定位到文本末尾


下一篇:google translate api post调用