on 08-06-2019 8:51 AM
Hello everyone,
I have a problem in deserializer with fieldname like this "message-a" : "Hello" ("-").
I followed the link in here https://wiki.scn.sap.com/wiki/display/Snippets/One+more+ABAP+to+JSON+Serializer+and+Deserializer but it does not work.
I have tried: message__H__a, message_a (cannot try fieldname message-a). If I declare "lv_out" with dynamic type (type ref to data), it could work, but I would like to parse in static way because it is easy for me to control my code.
Could you please give me your idea how to parse this? Thank you so much for reading.
PRETTY_NAME :
Encoding rules ABAP name → JSON name):'__E__' → '!''__N__' → '#''__D__' → '$''__P__' → '%''__M__' → '&''__S__' → '*''__H__' → '-''__T__' → '~''__L__' → '/''__C__' → ':''__V__' → '|''__A__' → '@''__O__' or '___' → '.'
TYPES: BEGIN OF ty_out,
message__H__a TYPE string,
END OF ty_out.
DATA: lv_json TYPE string,
lv_out TYPE ty_out.
lv_json = '{"message-a": "Hello"}'.
/ui2/cl_json=>deserialize(
EXPORTING
json = lv_json
pretty_name = /ui2/cl_json=>pretty_mode-extended
CHANGING
data = lv_out ).
I think you (and me) might have old version of /UI2/CL_JSON. There are NOTES with updates mentioned in wiki article.
When I debug and check method PRETTY_NAME_EX (conversion/encoding for EXTENDED), then I can not find any conversion of "__H__" to "-".
This method version on my dev system is 15.03.2017...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your information. The root cause is actually in method Pretty_name_ex because the note is still not updated in my system too.
User | Count |
---|---|
76 | |
9 | |
8 | |
6 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.