乐趣区

关于abap:abap-json-添加转义-去除转义代码

REPORT ztest_xiaoyong_json.
DATA:
  ld_cv_string TYPE string,
  lv_out       TYPE string.

ld_cv_string = '{\"model\":{\"PARTNER\":\"ACC202106070002\",\"ZZCRMNO\":\"ACC202106070002\",\"ZZCRSGT\":\"A\",\"ZZCDTFLG\":false,\"ZZCREDT2\":\"A\",\"ZZLMIT2\":\"2000.00\",\"ZCURRENCY\":\"CNY\",\"ZZFRMDAT2\":\"20210101\",\"ZZTODAT2\":\"20220101\"}}'.


* 如果加 \ 间接应用上面代码
*  REPLACE ALL OCCURRENCES OF `\` IN ld_cv_string WITH `\\`.
*  REPLACE ALL OCCURRENCES OF `"` IN ld_cv_string WITH `\"`.

* 如果去掉本义 应用上面代码
REPLACE ALL OCCURRENCES OF  `\"`  IN ld_cv_string WITH `"` .
REPLACE ALL OCCURRENCES OF  `\\` IN ld_cv_string WITH  `\`.
IF sy-subrc = 0.
ENDIF.
退出移动版