
Initial Release

This project is designed to run on InterSystems IRIS Community Edition, using Docker Compose as the deployment mechanism.
The deployment is based on Docker Compose. The IRIS Community image itself is defined in a local Dockerfile, which allows customization (for example, installing Python dependencies or loading initial code).
The project structure is:
.
├── iris
│ └── Dockerfile
│ └── src/
│ └── shared/
└── docker-compose.yml
Dockerfile defines the base image intersystems/iris-community.docker-compose.yml file orchestrates the container and volume mappings.shared/ is mounted inside the container as /shared.To build and start the environment, execute the following commands:
docker compose build
This command builds the IRIS Community image using the local Dockerfile.
docker compose up -d
This starts IRIS Community in detached mode.
The generated ObjectScript classes will be written by default to:
/shared/generated
which is mapped to the host filesystem through Docker volumes.
The purpose of this component is to convert a JSON document into ObjectScript classes for InterSystems IRIS, automatically generating:
%Persistent)%SerialObject) for nested JSON objectsAll generated classes:
%JSON.Adaptor%JSONFIELDNAME when required.cls files, ready for compilationThe generation process is designed to avoid:
All functionality is encapsulated in the class:
Utils.JSON2Class
ClassMethod Convert(
json As %String,
basePackage As %String = "App.Model",
rootClassName As %String = "Root",
outDir As %String = "/shared/generated"
) As %String
| Parameter | Description |
|---|---|
json |
Input JSON document as a string |
basePackage |
Base package name for generated classes (e.g. App.Model) |
rootClassName |
Name of the root class (first JSON level) |
outDir |
Directory where .cls files will be generated |
.cls file paths.The top-level JSON object is converted into a class that:
Extends:
%Persistent, %JSON.Adaptor
Represents the main entity of the model
Example:
Class App.Model.Person Extends (%Persistent , %JSON.Adaptor)
{
Property name As %String;
Property age As %Integer;
Property address As App.Model.Person.Address;
}
Each nested JSON object generates a class that:
Extends:
%SerialObject, %JSON.Adaptor
Is named by concatenating the parent class name and the property name
Example for a nested address object:
Class App.Model.Person.Address Extends (%SerialObject , %JSON.Adaptor)
{
Property street As %String;
Property city As %String;
}
This naming strategy avoids cross-dependencies and ensures a clear hierarchy.
All non-alphanumeric characters (including _) are removed
Example:
terminology_id → terminologyid
Whenever the property name differs from the original JSON field, the following mapping is added:
(%JSONFIELDNAME = "original_name")
Example:
Property terminologyid As %String (%JSONFIELDNAME = "terminology_id");
id Field HandlingIf a property is named id, it is automatically transformed into:
Property idJSON As %Integer (%JSONFIELDNAME = "id");
If a property name matches an IRIS SQL reserved word (case-insensitive):
JSON is appended%JSONFIELDNAMEExample:
Property orderJSON As %String (%JSONFIELDNAME = "order");
The Convert method receives a JSON string
The JSON is normalized and passed to Embedded Python using Base64
The JSON structure is analyzed recursively
The generator creates:
%Persistent root class%SerialObject classes.cls files are written to the configured output directory
Files are ready to be compiled in IRIS
set json = {\"name\":\"Ana\",\"age\":32,\"address\":{\"street\":\"X\"}}
set files = ##class(Utils.JSON2Class).Convert(json.%ToJSON(),"App.Model","Person")
write files
The generated classes will appear in:
/shared/generated
This component significantly accelerates the creation of ObjectScript domain models from JSON contracts, ensuring consistency, safety, and full compatibility with InterSystems IRIS.