A fast, robust command-line parser, formatter, and editor for JBeam files, the JSON-like format used by BeamNG to define vehicles and physics structures.
-
Complete Parsing: Parses entire
.jbeam
files, including comments and irregular whitespace, without breaking on manual edits. -
Consistent Formatting: Uniform indentation, spacing, and layout for improved readability.
-
Automatic Node Management: Renames nodes sequentially (e.g.,
["bf1", ...]
→["bf0", "bf1", "bf2"]
) and updates all references automatically. Feature currently unstable, enabled by build flagtransformation
. -
Configurable Formatting with JBFL: Customize formatting rules using JBFL, a mini-language to specify padding, decimals, indentation, and more with wildcard targeting.
Example JBFL snippet:
.*.nodes[*][*] { PadDecimals: 3; PadAmount: 8; } .*.flexbodies[*] { NoComplexNewLine: true; }
Generate a default formatting config with:
jbeam-edit -cminimal # simple config
jbeam-edit -ccomplex # detailed config
Config files are saved in:
- Linux/macOS:
$HOME/.config/jbeam-edit/rules.jbfl
- Windows:
%APPDATA%\jbeam-edit\rules.jbfl
Override per project by placing .jbeam_edit.jbfl
in your project root.
Go to the Releases page and download the most recent .zip
file.
Extract the contents of the downloaded .zip
archive to a folder of your choice.
Inside the extracted folder, right-click on setup.exe and choose Run as administrator.
If Windows shows a warning such as:
Windows protected your PC
Click More info → Run anyway.
The installer adds jbeam-edit
to your PATH, but:
- You must open a new Command Prompt or PowerShell window after installation.
- In some cases, you may need to log out or restart Windows for the PATH change to take effect.
- If it still doesn’t work, you can run it directly using the full path, e.g.:
"C:\Program Files (x86)\jbeam_edit\jbeam-edit.exe" your-file.jbeam
Press Win + R
, type cmd
or powershell
, and hit Enter.
Navigate to your project folder in CMD/PowerShell and run:
jbeam-edit your-file.jbeam
Replace your-file.jbeam
with the path to your JBeam file.
- Parses and formats the file.
- Sorts and renames nodes, updating references.
- Writes the output back with a
.bak
backup (default).
jbeam-edit -i example.jbeam
Clone and build with Cabal:
git clone https://github.com/webdevred/jbeam_edit.git
cd jbeam_edit
cabal update
cabal install
jbeam-edit your-file.jbeam
For sample .jbeam
files and JBFL rule files, see the Examples Directory README.
For an in-depth walkthrough of the implementation and design decisions, see EXPLANATION_OF_SOURCE_CODE.org.
- Language Server Protocol (LSP) support
- Automatic grouping of support vertices
- Prefix replacement via CLI arguments
- Sort a vertices using a threshold, Z values within the threshold are treated as equal; if too strict, compare the Y elements instead.
- Update specific ranges of vertices
- Expanded tests and example files
- Improved documentation
- Strong static typing for safer, reliable parsing and transformations.
- Elegant, composable parser combinators.
- Immutable data handling ensures predictable editing.
- Potential C/C++ port for easier Windows distribution.
- Trade-off: loss of Haskell’s expressiveness and safety vs. broader accessibility.
- Windows users (BeamNG players): none, just download the installer from Releases.
- Developers / Linux users:
Contributions and bug reports welcome. Licensed under BSD 3-Clause.
Happy parsing and formatting!