Ansicht
Dokumentation

ABENABAP_JSON_XML - ABAP JSON XML

ABENABAP_JSON_XML - ABAP JSON XML

ROGBILLS - Synchronize billing plans   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.
SAP E-Book

- XML Representation of JSON

JSON XML is an SAP-specific representation of JSON data in XML format. The single values, arrays, and objects in JSON are represented as follows in XML.

Single Values

Character-Like Values

"..." str>.../str>

Number Values

... num>.../num>

Boolean Values

true bool>true/bool>

false bool>false/bool>

Null Values

null null />

Data Structures

Arrays

[...] array>.../array>

The comma-separated components of arrays are mapped as subelements of the element array>, whereby the type-specific mapping rule applies to each element.

Note

Since the components of an array do not have names, the elements of an array in JSON-XML cannot have the corresponding attributes, unlike objects.

Objects

{...} object>.../object>

The comma-separated components of objects are mapped as subelements of the element object>. There are two representation methods:

  • "n":... ... name="n">.../...>
  • "n":... member name="n">...>.../...>/member>

In the first shorter method, used by default, a component is mapped like an element of an array, with the name n added to the type-specific XML element of the component as the content of the attribute name.

In the second longer method, the type-specific XML element of a component is nested in an additional element member>, which then has the attribute name with the name of the component.

Notes

  • In the longer alternative for object components, each component in JSON-XML is clearly marked by a member> element, which can help to distinguish objects of arrays when only partial fragments of JSON data are processed.
  • The longer alternative for object components with member> elements can be a better option for Simple Transformations, when ABAP data is serialized to JSON or deserialized from JSON.
  • A JSON writer that renders JSON-XML to JSON accepts both alternatives for object components. A JSON reader that parses JSON data to JSON-XML creates the shorter variant by default. To create the longer variant with member> elements, the method SET_OPTION of the interface IF_SXML_READER can be used to set the option IF_SXML_READER=>CO_OPT_SEP_MEMBER.

  • The program DEMO_JSON_XML shows examples of the default JSON-XML representation of valid JSON data.
  • The program DEMO_JSON_TO_JSON_XML allows any valid JSON data to be entered and displays its JSON-XML representation.
  • For information about the rendering and parsing of JSON-XML representations in both alternatives for object components, see Object Components in JSON-XML.





rdisp/max_wprun_time - Maximum work process run time   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.

Length: 6098 Date: 20240426 Time: 185216     sap01-206 ( 79 ms )