# mojangson
A small Python library for parsing, stringifying, simplifying, and normalizing [Mojangson](https://minecraft.fandom.com/wiki/NBT_format#Mojangson) - the textual representation of Minecraft's NBT (Named Binary Tag) data.
## Installation
```bash
pip install mojangson
```
## API
`parse` - Parse Mojangson text into a typed dict representation.
`stringify` - Convert a typed Mojangson dict back to a Mojangson string.
`simplify` - Simplify a typed Mojangson dict into a regular Python dict/list/primitive values, stripping Minecraft-specific type suffixes.
`normalize` - Normalize Mojangson text by parsing and then stringifying it - ensures consistent formatting and ordering.
## Usage example
```py
from mojangson import parse, stringify, simplify, normalize
mojangson_string = '{key:value}'
mojangson_parsed = parse(mojangson_string)
print(mojangson_parsed)
# {'type': 'compound', 'value': {'key': {'type': 'string', 'value': 'value'}}}
print(simplify(mojangson_parsed))
# {'key': 'value'}
mojangson_stringified = stringify(mojangson_parsed)
print(mojangson_stringified)
# {key:value}
print(normalize(mojangson_string) == mojangson_stringified)
# True
```
Raw data
{
"_id": null,
"home_page": "https://github.com/LunaticYouth/mojangson",
"name": "mojangson",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "json mojang nbt parser",
"author": "lunaticyouthie",
"author_email": "lunatic.youthie@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/0f/5a/439b6dc58efe5f40600f411afd255aa12a32f904d8ecfbd9a9272f0c51e1/mojangson-0.1.0.tar.gz",
"platform": null,
"description": "# mojangson\r\n\r\nA small Python library for parsing, stringifying, simplifying, and normalizing [Mojangson](https://minecraft.fandom.com/wiki/NBT_format#Mojangson) - the textual representation of Minecraft's NBT (Named Binary Tag) data.\r\n\r\n## Installation\r\n\r\n```bash\r\npip install mojangson\r\n```\r\n\r\n## API\r\n`parse` - Parse Mojangson text into a typed dict representation.\r\n\r\n`stringify` - Convert a typed Mojangson dict back to a Mojangson string.\r\n\r\n`simplify` - Simplify a typed Mojangson dict into a regular Python dict/list/primitive values, stripping Minecraft-specific type suffixes.\r\n\r\n`normalize` - Normalize Mojangson text by parsing and then stringifying it - ensures consistent formatting and ordering.\r\n\r\n## Usage example\r\n```py\r\nfrom mojangson import parse, stringify, simplify, normalize\r\n\r\nmojangson_string = '{key:value}'\r\n\r\nmojangson_parsed = parse(mojangson_string)\r\nprint(mojangson_parsed)\r\n# {'type': 'compound', 'value': {'key': {'type': 'string', 'value': 'value'}}}\r\n\r\nprint(simplify(mojangson_parsed))\r\n# {'key': 'value'}\r\n\r\nmojangson_stringified = stringify(mojangson_parsed)\r\nprint(mojangson_stringified)\r\n# {key:value}\r\n\r\nprint(normalize(mojangson_string) == mojangson_stringified)\r\n# True\r\n```\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Python MojangSON (NBT) parser",
"version": "0.1.0",
"project_urls": {
"GitHub": "https://github.com/LunaticYouth/mojangson",
"Homepage": "https://github.com/LunaticYouth/mojangson"
},
"split_keywords": [
"json",
"mojang",
"nbt",
"parser"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "8336583b9a7650b5e6521eb5c7bbffa7e8e28b7f77a1b45e712fd0cb79382e2a",
"md5": "5c3a98b2e40563cb2fba0e08f1f5348f",
"sha256": "cb1d4f33ef7a88fa4e8b0be5f8db0e3ea95e0f5d23f2c19d8679dc04301892ec"
},
"downloads": -1,
"filename": "mojangson-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5c3a98b2e40563cb2fba0e08f1f5348f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 10740,
"upload_time": "2025-08-15T09:53:40",
"upload_time_iso_8601": "2025-08-15T09:53:40.469321Z",
"url": "https://files.pythonhosted.org/packages/83/36/583b9a7650b5e6521eb5c7bbffa7e8e28b7f77a1b45e712fd0cb79382e2a/mojangson-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "0f5a439b6dc58efe5f40600f411afd255aa12a32f904d8ecfbd9a9272f0c51e1",
"md5": "0ff71ba6c09b4ef21dab63d808c4e609",
"sha256": "53c925aaf4f56113d39aaf8cba2bada20d600a04baa0e716a6e9cd5e4bc6fcb4"
},
"downloads": -1,
"filename": "mojangson-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "0ff71ba6c09b4ef21dab63d808c4e609",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 9597,
"upload_time": "2025-08-15T09:53:41",
"upload_time_iso_8601": "2025-08-15T09:53:41.487919Z",
"url": "https://files.pythonhosted.org/packages/0f/5a/439b6dc58efe5f40600f411afd255aa12a32f904d8ecfbd9a9272f0c51e1/mojangson-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-15 09:53:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "LunaticYouth",
"github_project": "mojangson",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "mojangson"
}