01-31-2018 3:14 PM
Hi all,
I'm looking to find the simplest method to take ABAP table data in SAP and format it into a json payload that apparently only accepts a variantion of camel case names. Examples being load, referenceNumbers, addressLine, etc.
Before I was aware of this restriction I created an abap structure with nested table types and used 'call transformation id' with a cl_sxml_string_writer created for json. This works fine other than all the structure fields are stored in uppercase so the json comes out that way. I could potentially do a find and replace on every field, but this seems like a poor solution. I've also read posts to the effect of using simple transformations, but I'm not very familiar with those and am having difficultly understanding how this would be helpful/implemented.
If anyone is willing to nudge me in right direction I would greatly appreciate it.
-Chris
01-31-2018 3:25 PM
/UI2/CL_JSON is pretty handy class to create JSON string from ABAP data.
It supports camelCase (pretty_name = /ui2/cl_json=>pretty_mode-camel_case).
Example:
In ABAP: test_name TYPE string.
In JSON: "testName"
or
In ABAP: test__name TYPE string.
In JSON: "test_name"
01-31-2018 3:25 PM
/UI2/CL_JSON is pretty handy class to create JSON string from ABAP data.
It supports camelCase (pretty_name = /ui2/cl_json=>pretty_mode-camel_case).
Example:
In ABAP: test_name TYPE string.
In JSON: "testName"
or
In ABAP: test__name TYPE string.
In JSON: "test_name"
01-31-2018 4:05 PM
02-25-2021 3:57 PM
Hi All,
I am trying to convert JSON into Internal table, do some operation on table and then covert the table back to JSON. I want to keep the fields of structure(which is used for JSON as it is. After serialization, the JSON should have field name same what I have given during deserialization.