Skip to main content

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"
}

安装:

pip install /path/to/lib/jsonmd

开发时可编辑安装:

pip install -e /path/to/lib/jsonmd

使用:

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"
}

Install:

pip install /path/to/lib/jsonmd

Editable install for development:

pip install -e /path/to/lib/jsonmd

Usage:

from jsonmd import loads, dumps

text = """
{
  content: <md># Title
- item
</md>
}
"""
data = loads(text)

encoded = dumps({"content": "# Title\n- item"})

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsonmd-0.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsonmd-0.1.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file jsonmd-0.1.0.tar.gz.

File metadata

  • Download URL: jsonmd-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for jsonmd-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0c22d88219915b5505ef57c1a73db8b4fe36498f28bfcf54d0b7d15a8e3effd8
MD5 ab9f554d1629bf744f3d9c1d750449d2
BLAKE2b-256 866b2b739a8a1f0c23f85beb410438871e38b33a1e162a551ff184424f12165e

See more details on using hashes here.

File details

Details for the file jsonmd-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: jsonmd-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for jsonmd-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5efe7a10a00c2aa45f639bfd392bc7a75be000c10ccfdc5a2d88ccebf777e702
MD5 02b2cd132fc32dd39603b99a5b85b479
BLAKE2b-256 8434bbebf1dbf45939f28141f9165c39348f545897b18e1544e5d35341b84471

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page