jason-RS
jason is a lightweight JSON templating tool that transforms reusable .jason template files into standard JSON. Build modular and composable JSON structures with parameter support and file inclusion.
✨ Features
- Template Parameters - Define reusable templates with named parameters
- File Inclusion - Compose JSON from multiple
.jasonfiles - 1:1 Conversion - Clean mapping from
.jasonsyntax to standard JSON - Library-First - Designed for seamless integration into Rust projects
🚀 Quick Start
Add jason-rs to your Cargo.toml:
[]
= "0.1"
Parse a Jason file:
use jason_to_json;
Example
Jason Templates
Person.jason - A reusable person template
(name, age) {
"name": #name,
"age": #age
}
Studio.jason - A static studio object
{
"name": "GameInc",
"ceo": "Dave Something"
}
Team.jason - Composing multiple templates
(project) {
"studio": <./Studio.jason>,
"project": #project,
"workers": [
<./Person.jason | "jay", 12>,
<./Person.jason | "mark", 14>,
<./Person.jason | "lee", 15>
]
}
Page.jason - The head of the composition.
{
"team": <./Team.jason | "Mario">
}
Generated JSON
Syntax Overview
| Syntax | Description |
|---|---|
(param1, param2) |
Define template parameters |
#param |
Reference a parameter value |
<./File.jason> |
Include another Jason file |
<./File.jason | arg1, arg2> |
Include with arguments |
Parses a .jason file at the given path and returns the resulting JSON as a String.
License
Licensed under the Apache License 2.0. See LICENSE for details.