The optional parameter is an object of type ComposerOptions.
Its attribute is:
Attribute | Type | Description | Allowed Values |
---|
compact | Boolean | When compact is true, the JSON composer will generate compact JSON, otherwise it will generate pretty JSON. The default behavior of classToJson() (i.e. when called without options) is equivalent to compact=false. | true | Generate compact JSON. |
false | Generate pretty JSON (default). |
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 classToJson() (i.e. when called without options) is equivalent to keepNulls=false. | true | Render NULL attributes to the JSON object. |
false | Leave out NULL attributes (default). |
writeTypeDiscriminator | Boolean | This is necessary if you want to convert the generated JSON back to an xUML class using jsonToClass(). Runtime versions before 2021.6 will ignore the value. | true | Write xUML type discriminator (default). |
false | Do not write xUML type discriminator. |