Skip to Content
May 05, 2021 at 01:58 PM

ABAP (Deep Structure with Table Type) to JSON Conversion

1233 Views Last edit Jun 30, 2021 at 04:26 PM 5 rev


I'm in the process of dynamically getting JSON string from nested structure or table type, example "VMDS_EI_MAIN". And i'm using below class to serialize

ls_json-value = /ui2/cl_json=>serialize( data = gs_vmds_extern compress = abap_false
pretty_name = /ui2/cl_json=>pretty_mode-camel_case ).

It gives me just field name 'vendor' as table type

where as i'm expecting a JSON output with fields of all nested structures and table types of 'VMDS_EI_MAIN" inside {"vendors": [] }

Really grateful on any help in this.

Brief about my requirement.

Creating a OData service which will call class and methods dynamically. I need to pass method parameter(s) value as JSON, so first I need to get JSON format of given method parameter so that user can give input values in required fields. Now the JSON string will be send with input values that should be deserialized and passed to respective method parameter.

Thanks in advance



ilrin.png (3.5 kB)