NNL parser/serializer - Near Natural Language (JSON-capable)
Project description
NNL โ Near Natural Language
A Human-Readable, JSON-Compatible Data Language
๐ฑ What is NNL?
NNL (Near Natural Language) is a human-friendly, indentation-based data notation that looks like simple English sentences but maps 1:1 to JSON.
Write this:
user contains:
name is Alice.
age is 30.
roles are admin, editor.
And get this JSON:
{
"user": {
"name": "Alice",
"age": 30,
"roles": ["admin", "editor"]
}
}
NNL is perfect for:
- Configuration files
- API payloads
- Human-editable datasets
- Documentation / examples
- Structured content
โจ Features
-
Full JSON compatibility
-
Human-readable, minimal punctuation
-
Natural English-like syntax
-
Supports:
- objects (
contains:) - arrays (
are:) - inline lists (
a, b, c) - arrays of objects
- nested structures
- numbers, strings, booleans, null
- objects (
-
Round-trip safe (NNL โ JSON โ NNL)
๐ง Installation
After publishing to PyPI:
pip install nnlpy
Local development install:
pip install -e .
๐งช Usage (Python)
from nnl import parse_nnl, dump_nnl
text = """
user contains:
name is Alice.
age is 22.
roles are admin, editor.
"""
data = parse_nnl(text)
print(data)
# {'user': {'name': 'Alice', 'age': 22, 'roles': ['admin', 'editor']}}
print(dump_nnl(data))
๐ CLI Usage
After install, the command nnl becomes available:
NNL โ JSON
nnl nnl2json file.nnl
Or via stdin:
type file.nnl | nnl nnl2json -
JSON โ NNL
nnl json2nnl file.json
๐ Language Basics
Objects
project contains:
name is Atlas.
version is 1.0.
Inline Lists
tags are alpha, beta, gamma.
Block Lists
items are:
- apple.
- banana.
- cherry.
Arrays of Objects
users are:
- contains:
id is 1.
name is Alice.
- contains:
id is 2.
name is Bob.
Nested Lists (Matrices)
matrix are:
- 1, 2, 3.
- 4, 5, 6.
๐ Documentation
See the docs directory:
- spec.md โ Official NNL Specification v1.0
- examples.md โ Practical examples & patterns
๐งช Testing
Run the test suite:
pytest -q
๐จ Development
Install dependencies
pip install -e . pytest
Project Structure
nnl/
โโโ nnl/
โ โโโ __init__.py
โ โโโ core.py
โ โโโ cli.py
โโโ tests/
โ โโโ test_nnl_basic.py
โโโ docs/
โ โโโ spec.md
โ โโโ examples.md
โโโ example.nnl
โโโ pyproject.toml
โโโ README.md
โโโ LICENSE
โโโ CONTRIBUTING.md
๐ Publishing (PyPI)
Build:
python -m build
Upload:
twine upload dist/*
๐ค Contributing
Pull requests and issues are welcome. NNL is designed to be readable, stable, and easy to extend.
๐ License
MIT License
See LICENSE for details.
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 nnlpy-0.4.0.tar.gz.
File metadata
- Download URL: nnlpy-0.4.0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f56ea4a98bf3f875434022184f9b9e205753a339b2feeb1878c6c90820d9a605
|
|
| MD5 |
3ceac66e6e4c28059092e3e34692d9eb
|
|
| BLAKE2b-256 |
1824b8e436ac8f0897e68d41d73cba0c44cd60177ebc9f9b11e0d38dff35ca56
|
File details
Details for the file nnlpy-0.4.0-py3-none-any.whl.
File metadata
- Download URL: nnlpy-0.4.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b03668e27eaf1b5cafe4b69be9fee581c3f1ab01d75471f8408bf17a85ff08f
|
|
| MD5 |
a637d2bd4d8097bb75638ef73510d6c4
|
|
| BLAKE2b-256 |
2817033e22f721d5cb237c669bd7626e5cc73f374d589491757e2e437026fe5d
|