Closed oblomov-dev closed 5 months ago
Sorry for late response. Well ... looks like a bug on the one hand. But on the other the ii_custom_mapping
is a deprecated feature - https://github.com/sbcgua/ajson?tab=readme-ov-file#mapping-via-to_abap-and-to_json-deprecated - in favor of filter
method. So I'd better not rely on this particular feature but use the filter
approach instead.
ah thank you for the hint, overlooked that this is deprecated, in my specific situation i use now the following APIs and it works as i would expect:
DATA(lo_json) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>new( ) ).
lo_json->set( iv_path = `/` iv_val = val ).
IF config-custom_mapper IS BOUND.
lo_json = lo_json->map( config-custom_mapper ).
ELSE.
lo_json = lo_json->map( z2ui5_cl_ajson_mapping=>create_upper_case( ) ).
ENDIF.
IF config-custom_filter IS BOUND.
lo_json = lo_json->filter( config-custom_filter ).
ELSE.
lo_json = lo_json->filter( z2ui5_cl_ajson_filter_lib=>create_empty_filter( ) ).
ENDIF.
Good to know! So the issue can be closed?
yes thanks for the help!
Not sure if this is an intended behaviour, but i was suprised:
The returning object of the filter fucntion does not get the mapping of the original object:
But maybe my understanding of the API was just wrong and everything is fine like this.