I've been working on Stof, a new approach to data that combines the simplicity of JSON/YAML with the power of a sandboxed programming language.
The problem: We're constantly juggling different data formats (JSON, YAML, TOML, CSV), writing glue code to transform between them, and dealing with the limitations of static data when we need dynamic behavior.
What makes Stof different:
- Code is data, data is code – Your data documents can contain functions, logic, and transformations
- Multi-format support – Import/export JSON, YAML, TOML, binary formats seamlessly
- Built-in type system – Unit types (`6ft + 1in`), expressions, and proper data validation
- Sandboxed execution – Safe for running untrusted code, perfect for embedded environments
- ECS architecture – Think beyond just "fields" – embed PDFs, 3D models, voice data as components
fn findUser(query: str) -> obj {
for (const user in self.users) {
if (user.name.lower().contains(query)) return user;
}
null
}
#[main]
fn main() {
const joe = self.findUser("joe");
let output = stringify("toml", joe);
pln(output);
}
Use cases I'm excited about:
- Configuration files that can validate and transform themselves
- Data pipelines without separate processing code
- API responses that contain their own transformation logic
- Embedded systems running user-provided data safely
The project is open source and looking for contributors. We're building something that will change how we think about the data/code boundary.
The problem: We're constantly juggling different data formats (JSON, YAML, TOML, CSV), writing glue code to transform between them, and dealing with the limitations of static data when we need dynamic behavior.
What makes Stof different: - Code is data, data is code – Your data documents can contain functions, logic, and transformations - Multi-format support – Import/export JSON, YAML, TOML, binary formats seamlessly - Built-in type system – Unit types (`6ft + 1in`), expressions, and proper data validation - Sandboxed execution – Safe for running untrusted code, perfect for embedded environments - ECS architecture – Think beyond just "fields" – embed PDFs, 3D models, voice data as components
Here's a quick example: const users: [ { name: "Joe Schmo", height: 6ft + 1in, // Unit calculations built-in age: +32 } ]
fn findUser(query: str) -> obj { for (const user in self.users) { if (user.name.lower().contains(query)) return user; } null }
#[main] fn main() { const joe = self.findUser("joe"); let output = stringify("toml", joe); pln(output); }
Use cases I'm excited about: - Configuration files that can validate and transform themselves - Data pipelines without separate processing code - API responses that contain their own transformation logic - Embedded systems running user-provided data safely
The project is open source and looking for contributors. We're building something that will change how we think about the data/code boundary.
Try it out: https://docs.stof.dev/ GitHub: https://github.com/dev-formata-io/stof
What do you think? Has anyone else felt frustrated by the limitations of static data formats?