Camel case does not work correctly for nested structures.
REPORT ztest_ajson_camel.
TYPES:
BEGIN OF ty_snap_simple,
code TYPE string,
file_name TYPE string,
BEGIN OF profile_info,
show_fullname TYPE abap_bool,
position TYPE string,
END OF profile_info,
END OF ty_snap_simple.
DATA:
ls_json TYPE ty_snap_simple,
li_mapping TYPE REF TO /mbtools/if_ajson_mapping,
lo_json TYPE REF TO /mbtools/if_ajson,
lv_data TYPE string.
ls_json-code = 'REPORT zfoobar.\n'.
ls_json-file_name = 'test.abap'.
ls_json-profile_info-show_fullname = abap_true.
ls_json-profile_info-position = 'bottom-center'.
TRY.
li_mapping = /mbtools/cl_ajson_mapping=>create_camel_case( iv_first_json_upper = abap_false ).
lo_json = /mbtools/cl_ajson=>create_empty( ii_custom_mapping = li_mapping ).
lo_json->keep_item_order( ).
lo_json->set(
iv_path = '/'
iv_val = ls_json ).
lv_data = lo_json->stringify( 2 ).
CATCH cx_root.
BREAK-POINT.
ENDTRY.
WRITE lv_data.
Camel case does not work correctly for nested structures.
I will submit PR