问题描述
正如 Horst Keller 在他的 (这也解释了如何创建有效的 JSON 序列化程序).使用 json lint http://jsonlint.com/ 验证您的 json 以查看它是否有效.. 否则,那就是当然,在调试它为什么会工作时会遇到很多麻烦,并且没有意识到序列化程序已损坏.问候,zY
As Horst Keller mentioned in his ABAP and JSON post, "with Releases 7.02 and 7.03/7.31 (Kernelpatch 116) JSON is supported natively in ABAP".
Appartently 7.02 in my case of too generic because the line below:
writer = cl_sxml_string_writer=>create( type = if_sxml=>co_xt_json ).
returns the error: "The field CO_XT_JSON is unknown, but there is a field with the similar name CO_XT_XOP".
So is there any way to easily generate JSON?
Edit: Screenshot from SAP - Status
About the class CL_TREX_JSON_SERIALIZER: I also used this class during developping a mobile sap application and I found the created JSON not being valid, thus I started googling and found this http://scn.sap.com/community/mobile/blog/2012/09/24/serialize-abap-data-into-json-format (which also explains how to create a valid JSON serializer).Validate your json with json lint http://jsonlint.com/ to see if it is valid.. otherwise, thats for sure, you get a lot of trouble in debugging why it doenst work and dont get the point that the serializer is corrupt. regards, zY
这篇关于如何在 7.02 之前的 ABAP 中对 JSON 进行编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!