Class
JSONParser
Parser for JSON files in emfjson/pyecore format
actor JSONParser
Overview
The JSON parser converts JSON files into EMF-compatible object graphs stored in Resources. It handles:
-
Single root objects and arrays of root objects
-
Nested containment references
-
Cross-references (using $ref)
-
Type information via eClass field
-
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 parser = JSONParser()
let resource = try await parser.parse(jsonURL)
let roots = await resource.getRootObjects()
Topics
Initializers
Initializes a new JSON parser
Instance Methods
Parse a JSON file and return a Resource containing the objects
Default Implementations
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
Serializes EMF objects to JSON format (emfjson/pyecore compatible)