ABAP Keyword Documentation → ABAP - Reference → Data Interfaces and Communication Interfaces → ABAP and JSON → Transformations for JSON → asJSON - Canonical JSON Representation → asJSON - Mapping of ABAP Data Types
asJSON - Mapping of Reference Variables and Objects
A reference mechanism is used (like in asXML) for the asJSON display of anonymous data objects and class instances (objects), which are addressed using references in reference variables. As JSON does not suggest any syntax for references, an SAP-specific reference mechanism based on asXML is used.
- Named reference variables are displayed as object components, whose content is usually a key for the referenced objects.
- The referenced objects are stored as object components in the object %heap. This name corresponds to the key.
In addition to the value, the dynamic type of the reference variables is specified in the object components of %heap when serialization takes place. This ensures that deserialization is unambiguous.
Other versions:
7.31 | 7.40 | 7.54
Note
- The asJSON representation of reference variables and referenced objects is only of relevance for XSL transformations and the identity transformation ID. Simple transformations cannot currently be used to transform reference variables.
- For data references, the value "embedded" can be specified for the
transformation option
data_refs
to define embedded storage in serializations instead of storage in the %heap object component.
Example
For information about the differences between serializing to %heap and embedded storage, see Serializations to Heap or Embedded.
Continue
asJSON - Named Reference Variables