SAP ABAP JSON XML ABEXA

Get Example source ABAP code based on a different SAP table
  


ARTICLE

JSON, Object Components in JSON-XML
This example demonstrates the two alternatives for object components in JSON-XML.

ABAP_SOURCE_CODE
ABAP_EXEC

ABAP_DESCRIPTION
The string json_xml is filled with XML data in valid JSON-XML and displayed. The element <(><<)>object> contains elements that embody JSON object components directly and <(><<)>member> elements that wrap these components.
A JSON reader parses the string json_xml by calling the method SKIP_NODE in a single action and passes the XML data to a JSON writer created with the type IF_SXML=>CO_XT_JSON. The output of this writer is passed to the string json, which then contains valid JSON data. The writer has applied both alternatives to the object components with the same result.
The string json is parsed with two further XML readers. The first parses with standard setting and the setting applies the option IF_SXML_READER=>CO_OPT_SEP_MEMBER. In the JSON-XML result of the first reader, no object component has a <(><<)>member> element; in the JSON-XML results of the second reader, every object component is displayed with a <(><<)>member> element.