| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Designed for simplicity, flexibility, and clarity.
Python - 3.8 or higher
The tinycolors library: 0.6.0 or higher (is only used for pretty testing)
Install using:
pip install tinycolors
# or however your venv manager allowsInstall tobj using the pip package manager:
pip install tobjOr use whatever package manager is used inside your venv, such as
uv add tobj
# or
pipx install tobj
# ...Use tobj as you will inside your projects as a module; write and read files like you would in a JSON manner.
import tobj
with open('example.tobj', 'r') as f:
result = tobj.load(f) # 'result' is now the loaded content
# of the .tobj file in dict form!
tobj.dump({"User": {"name": "Alice", "age": 20, "balance": 2000}}, f)
manual_result = tobj.loads("*User>name Alice>age 20>balance 2000") # {"User": {"name": "Alice", "age": 20, "balance": 2000}}
manual_dumps = tobj.dumps({"User": {"name": "Alice", "age": 20, "balance": 2000}}) # *User>name Alice>age 20>balance 2000TOBJ is designed to be simple and human-readable. Here’s a quick overview of its syntax:
For more information, RTFM on ReadTheDocs.
Here's a comprehensive example:
*$ // supports this comment; the $ symbol is supported, and conventionally used as a 'global' object
> key ctrl+alt+c
> action "Suspend Machine"
> timeout 10
*User # supports this comment to!
> name Alice
> age 30
> active true # special keyword
> pet nothing # special 'null' keyword
*User.profile # use dot paths to represent hierarchical objects
> bio "Hello World"
> score 9001
*User.tags
> favorites
- python
- rust
- C++
> "nothing" nothing # also use strings as the property identifier to avoid colliding with keyword
TinyObj is not designed to be a JSON replacement or to be blazing fast, but it offers:
JSON is verbose, fragile for humans, and painful to diff. TinyObj is designed for:
Contributions are welcome! Fork the repo, create a branch, and craft your great creations, then submit a Pull Request.
This project is licensed under the MIT License - see LICENSE (or the LICENSE badge) for details.
In case you missed it, here's the documentation, and the GitHub repo.
| Back | FazBrowse Home | New Git URL |