JSON Adapter Reference
JSON Operations
classToJSON
Syntax |
| |
---|---|---|
Semantics | The operation
| |
Substitutables |
| Any object. |
| Target JSON document as String. | |
| The optional parameter is an object of type ComposerOptions. Please find a detailed description of the properties below. | |
Examples |
NONE
|
ComposerOptions
Attribute | Type | Description | Allowed Values | |
---|---|---|---|---|
keepNulls | Boolean | When keepNulls is true, attributes of anObject with NULL values will be rendered to the JSON object, otherwise they will be left out completely (see also chapter NULL Values). The default behavior of | true | Render NULL attributes to the JSON object. |
false | Leave out NULL attributes (default). | |||
compact | Boolean | When compact is true, the JSON composer will generate compact JSON, otherwise it will generate pretty JSON. The default behavior of | true | Generate compact JSON. |
false | Generate pretty JSON (default). | |||
writeTypeDiscriminator | Boolean | Use writeTypeDiscriminator to suppress the generation of xUML type properties ("e2e:type") to the generated JSON. If this option is true, the Runtime will write the original xUML type to the generated JSON in form of Runtime versions before 2021.6 will ignore the value. | true | Write xUML type discriminator (default). |
false | Do not write xUML type discriminator. |
classToExtendedJSON
Syntax |
| |
---|---|---|
Semantics | The operation In opposition to classToJSON(), If the conversion is not possible, an error is raised.
| |
Substitutables |
| Any object. |
| Target Extended JSON document as String. | |
| String that specifies the format of the Extended JSON that should be produced (more details see | |
| This optional parameter is an object of type ExtendedJSONComposerOptions. Please find a detailed description of the properties below. | |
Examples |
NONE
|
For more information on Extended JSON refer to MongoDB Extended JSON.
ExtendedJSONComposerOptions
Attribute | Type | Description | Allowed Values | |
---|---|---|---|---|
format | String | Use format to specify which kind of Extended JSON should be produced: canonical or relaxed Extended JSON. | canonical | Produce canonical Extended JSON (default). |
relaxed | Produce relaxed Extended JSON. | |||
keepNulls | Boolean | When keepNulls is true, attributes of anObject with NULL values will be rendered to the Extended JSON object, otherwise they will be left out completely (see also chapter NULL Values). The default behavior of | true | Render NULL attributes to the Extended JSON string. |
false | Leave out NULL attributes (default). | |||
writeTypeDiscriminator | Boolean | Use writeTypeDiscriminator to suppress the generation of xUML type properties ("e2e:type") to the generated JSON. If this option is true, the Runtime will write the original xUML type to the generated JSON in form of In contrast to classToJSON() Operation, writeTypeDiscriminator defaults to false for | true | Write xUML type discriminator. |
false | Do not write xUML type discriminator (default). |
jsonToClass
Syntax |
| |
---|---|---|
Semantics | The operation By default, the following mapping rules apply:
For more mapping details refer to JSON Type Mapping. | |
Substitutables |
| A JSON document as String. |
| Target object, can be any object. | |
| String literal. | |
Examples |
NONE
The action script below creates an object of type Address. An output object flow state named myAddress of type Address needs to be defined in the activity diagram.
NONE
The example below shows how to specify the xUML type at runtime, e.g. if using a derived class.
NONE
The xUML type is declared by the attribute " |
For more information on JSON refer to the JSON Homepage or to RFC 4627.
JSONAdapter_Example
Click here to download a simple example model that shows the usage of the JSON adapter (classToJSON) in Scheer PAS Designer.
Related Documentation: