syside.json.dumps

dumps(element: syside.Element, options: syside.SerializationOptions, indent: int = 2, use_spaces: bool = True, final_new_line: bool = True, include_cross_ref_uris: bool = True) str[source]

Serialize element to a SysML v2 JSON str.

See the documentation of the SerializationOptions class for documentation of the possible options. The options object constructed with SerializationOptions.minimal instructs to produce a minimal JSON without any redundant elements that results in significantly smaller JSONs. Examples of redundant information that is avoided using minimal configuration are:

  • including fields for null values;

  • including fields whose values match the default values;

  • including redefined fields that are duplicates of redefining fields;

  • including derived fields that can be computed from minimal JSON (for example, the result value of evaluating an expression);

  • including implied relationships.

Note

SysIDE does not construct all derived properties yet. Therefore, setting options.include_derived to True may result in a JSON that does not satisfy the schema.

Parameters:
  • element – The SysML v2 element to be serialized to SysML v2 JSON.

  • options – The serialization options to use when serializing SysML v2 to JSON.

  • indent – How many space or tab characters to use for indenting the JSON.

  • use_spaces – Whether use spaces or tabs for indentation.

  • final_new_line – Whether to add a newline character at the end of the generated string.

  • include_cross_ref_uris – Whether to add potentially relative URIs as @uri property to references of Elements from documents other than the one owning element. Note that while such references are non-standard, they match the behaviour of XMI exports in Pilot implementation which use relative URIs for references instead of plain element IDs.

Returns:

element serialized as JSON.