Structure
JSONSerializer
Serializes EMF objects to JSON format (emfjson/pyecore compatible)
struct JSONSerializer
Overview
The JSON serializer converts in-memory object graphs stored in Resources to JSON files. It handles:
-
Single root objects and multiple root objects
-
Nested containment references
-
Cross-references (using $ref)
-
Compatible with pyecore and emfjson-jackson formats
JSON Format
Single root object:
{
"eClass": "http://package.uri#//ClassName",
"attribute": "value",
"reference": { ... }
}
Multiple root objects:
[
{ "eClass": "...", ... },
{ "eClass": "...", ... }
]
Usage Example
let serializer = JSONSerializer()
try await serializer.serialize(resource, to: outputURL)
Topics
Initializers
Initialize a new JSON serializer
Instance Methods
Serialize a Resource to a JSON string
Serialize a Resource to a JSON file
Relationships
Conforms To
See Also
Resources and Serialisation
A resource manages model objects and provides EMF-compliant reference resolution.
A resource set manages multiple resources and enables cross-resource reference resolution.
Parser for XMI (XML Metadata Interchange) files
Serialises EMF objects to XMI (XML Metadata Interchange) format
Parser for JSON files in emfjson/pyecore format