scjson: C#, go, java, javascript / typescript, lua, python, ruby, rust, and swift
10K+
A JSON-based serialization of SCXML (State Chart XML) for modern tooling, interoperability, and education.
scjson is a structured, schema-based representation of SCXMLβ , the W3C standard for state machine modeling. This format preserves the semantics and hierarchy of SCXML while making it more accessible to modern tools, languages, and interfaces.
Why JSON?
The canonical scjson.schema.json file is located in /schemaβ .
It is generated from Pydantic models and used to validate all *.scjson documents.
Each language implementation lives in its own directory, as a standalone module or library root:
/schema/ β JSON Schema definition of scjson /examples/ β SCXML and scjson sample pairs /tutorial/ β Git submodule: Zhornyak SCXML tutorial /python/ β Python reference implementation (CLI + library) /js/ β JavaScript CLI and library /ruby/ β Ruby CLI and gem /go/ β Go command line utility /rust/ β Rust command line utility /swift/ β Swift command line tool /java/ β Java command line tool /lua/ β Lua scripts /csharp/ β C# command line tool
Each directory is designed to be independently usable as a library or CLI tool.
| Language | Status | Path | Notes |
|---|---|---|---|
| Python | β Stable | /pyβ | Reference CLI |
| JavaScript | β Beta | /jsβ | Node CLI |
| Ruby | β Beta | /rubyβ | Gem CLI |
| Go | β Beta | /goβ | Go binary |
| Rust | β Beta | /rustβ | Cargo crate |
| Swift | β Beta | /swiftβ | Swift package |
| Java | β Beta | /javaβ | Maven CLI |
| Lua | β Basic | /luaβ | Lua scripts |
| C# | β Beta | /csharpβ | .NET CLI |
| ---## Examples & Test Suite |
This repo includes a curated set of canonical SCXML examples and their equivalent scjson forms in /examplesβ . These are used for:
These examples are derived from and/or adapted from:
We include Alex Zhornyakβs SCXML Editor Tutorial as a Git submodule under /tutorialβ .
This provides a rich set of canonical SCXML test cases and diagrams.
Attribution is provided for educational purposes. No endorsement is implied.
Source: https://alexzhornyak.github.io/ScxmlEditor-Tutorial/β
If you cloned this repo and /tutorial is empty, run:
git submodule init
git submodule update
Or clone with submodules in one step:
git clone --recurse-submodules https://github.com/your-org/scjson.git
This ensures you get the complete tutorial content alongside the examples and converters.
All converters share the same schema and test suite to ensure compatibility.
# Convert from SCXML to scjson
scjson convert --from scxml path/to/file.scxml --to scjson path/to/file.scjson
# Validate a scjson file
scjson validate path/to/file.scjson
The Java implementation uses Maven. If your environment requires an HTTP/HTTPS
proxy, create ~/.m2/settings.xml with proxy settings before building:
<settings>
<proxies>
<proxy>
<id>internal-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy</host>
<port>8080</port>
<nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>
</proxy>
<proxy>
<id>internal-proxy-https</id>
<active>true</active>
<protocol>https</protocol>
<host>proxy</host>
<port>8080</port>
<nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>
</proxy>
</proxies>
</settings>
Build the module with:
cd java && mvn clean install -DskipTests -B && cd ..
pypi: [https://pypi.org/project/scjson/β ]
pip install scjson
For a full example of installing toolchains and dependencies across languages see codex/startup.shβ .
cd py
pip install -r requirements.txt
pytest -q
cd js
npm ci
npm test --silent
cd ruby
gem install bundler
bundle install
bundle exec rspec
cd go
go test ./...
go build
cd rust
cargo test
cd swift
swift test
cd csharp
dotnet test -v minimal
cd lua
luarocks install luaexpat --deps-mode=one
luarocks install dkjson --deps-mode=one
luarocks install busted --deps-mode=one
busted tests
Content type
Image
Digest
sha256:e2834ee7aβ¦
Size
3.7 GB
Last updated
about 1 year ago
docker pull iraa/scjson