minicem
A small, readable text format that is plainer than JSON and simpler than YAML, and uses fewer tokens in AI prompts.
minicem is a small, human-friendly text format I designed for small configuration files and AI prompts. It is less noisy than JSON and less complex than YAML. Along with the format I wrote an encoder and a decoder function for Python and published the package on PyPI.
Purpose
Sending structured data inside prompts to language models is very common, and that data is usually sent as JSON. JSON is a reliable format, but details such as quoting every key and spelling out true, false and null make the text longer. With language models, every character roughly turns into token cost, so that extra length means money and time.
I built minicem so the same data could be written with fewer characters while staying readable. My goal was a format simple enough to write by hand and strict enough for a program to read back without problems.
How it works
In minicem, dictionaries are written with curly braces and lists with square brackets. Keys do not need quotes. Text values without spaces can also be written without quotes; quotes are used only when needed. True is shortened to +1, false to +0 and null to _. Everything after a # sign outside quotes is treated as a comment.
Data can be written on a single line or spread over several lines in a YAML-like layout. On the Python side, the encode_mt function turns a Python object into minicem text and the decode_mt function turns that text back into a Python object. When you encode some data and decode it again, you get exactly the data you started with.
Key features
- It supports the basic Python types: dictionaries, lists, strings, integers, floats, booleans and None.
- True, false and null are written with short symbols.
- It allows comments, which helps with hand-written configuration files.
- It supports both single-line and multi-line block layouts.
- On the sample data in the README, its output is about 15 percent shorter than compact JSON.
- It works with Python 3.8 and later and installs with a single pip command.
Technical stack
minicem is a small library written in pure Python with no external dependencies. I distribute it through PyPI, and the source code is open on GitHub.
Use cases
- Passing structured data in prompts to language models while spending fewer tokens.
- Using the context window more efficiently in AI applications that work with long contexts.
- Writing small settings and configuration files by hand.
- Command-line tools or scripts that need a short, readable data format.
- Category
- AI tools
- Year
- 2025
Technologies
- Python
- PyPI
- LLM
- Open Source