如何在7.02之前的ABAP中编码JSON [英] How to encode JSON in ABAP before 7.02
问题描述
正如霍斯特·凯勒(Horst Keller)在其 ABAP和JSON 帖子,"ABAP本地支持7.0.2和7.03/7.31版(内核补丁116)JSON".
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".
在我看来太通用的情况下,大概是7.02,因为下面的行:
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 ).
返回错误:"The field CO_XT_JSON is unknown, but there is a field with the similar name CO_XT_XOP".
那么有什么方法可以轻松生成JSON?
SAP的屏幕截图-状态
Screenshot from SAP - Status
推荐答案
关于类 CL_TREX_JSON_SERIALIZER :我在开发移动sap应用程序时也使用了该类,但发现创建的 JSON不是是有效的,因此我开始进行谷歌搜索,发现此 http://jsonlint.com/验证您的json是否有效.当然,您在调试时会遇到很多麻烦,原因是它确实起作用,而又没有弄清序列化程序已损坏.问候,zY
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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!