JSON/JSON5 loader and dumper with raw multiline markdown block support
Project description
jsonmd
背景
在人机协作时代,提示词和结构化文本配置会被开发者与 AI 代理高频共同编辑。 可读性和低摩擦编辑能力会直接影响迭代速度与交付质量。
jsonmd 用来解决 JSON 不支持原生多行字符串的问题。
通过 <md>...</md> 语法标记,你可以在 JSON/JSON5 中嵌入原始多行文本块
(例如 Markdown),而不需要使用 \n 转义符。
这让在配置文件中存储富文本更直观、可读性更高。
示例:
{
content: <md># Title
- item
</md>
}
而不是:
{
"content": "# Title\n- item"
}
使用
from jsonmd import loads, dumps
text = """
{
content: <md># Title
- item
</md>
}
"""
data = loads(text)
encoded = dumps({"content": "# Title\n- item"})
Background
In the era of human-AI collaboration, prompts and structured text configs are edited frequently by both developers and AI agents. Readability and low-friction editing directly affect iteration speed and quality.
jsonmd solves the problem that JSON does not support native multiline strings.
With <md>...</md> block markers, you can embed raw multiline text
(for example Markdown) in JSON/JSON5 without \n escaping.
This makes rich text in config files easier to read and maintain.
Example:
{
content: <md># Title
- item
</md>
}
instead of:
{
"content": "# Title\n- item"
}
Usage
from jsonmd import loads, dumps
text = """
{
content: <md># Title
- item
</md>
}
"""
data = loads(text)
encoded = dumps({"content": "# Title\n- item"})
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jsonmd-0.1.1.tar.gz.
File metadata
- Download URL: jsonmd-0.1.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e6e6c318432c12d44d9a165b648d83ea1b82f42eef9fd1ef2eb31fbbe1b3e5b
|
|
| MD5 |
f0d10f247eee63c8048a7ed6885d843e
|
|
| BLAKE2b-256 |
e39a005d87d078c573b9a963320a07af27ac00a0655a55a0170b3f61806f1bbd
|
File details
Details for the file jsonmd-0.1.1-py3-none-any.whl.
File metadata
- Download URL: jsonmd-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e11db95098b3245e7ddfe8871cb1ef26d975e3a1e7bb471d612d57e76138c25
|
|
| MD5 |
9082e5cd3767f3a38b9c77284ea47946
|
|
| BLAKE2b-256 |
4c1b363bbd0d09c7c672ffabefe337cda928a35087b2c760b58a27fa7b64a429
|