semvec/pypi-packages huggingface dataset:
json-toon 1.0.2
Convert Python data to TOON (Token-Oriented Object Notation) - A lightweight, LLM-friendly structured data format
Requires Python: >=3.8
Keywords: json, toon, converter, llm, prompt

# JSON Toon

Convert Python data structures to/from **TOON** (Token-Oriented Object Notation) - a lightweight, human-readable format optimized for LLM-friendly structured data.

## Installation

```bash
pip install json-toon
```

## What is TOON?

TOON is a Token-Oriented Object Notation format that represents structured data in a clean, readable way:
- Nested dictionaries with indentation
- Tables for lists of objects (using `|` separators)
- Comma-separated lists for simple arrays
- Human-readable and LLM-friendly

## Usage

### Convert Python Data to TOON Format

```python
from json_toon import json_to_toon

data = {
    "name": "Alice",
    "age": 30,
    "items": ["apple", "banana", "cherry"]
}

toon_string = json_to_toon(data)
print(toon_string)
# Output:
# name: Alice
# age: 30
# items:
#   apple, banana, cherry
```

### Convert TOON Back to Python Data

```python
from json_toon import toon_to_json

toon_text = """
name: Alice
age: 30
items:
  apple, banana, cherry
"""

data = toon_to_json(toon_text)
print(data)
# Output: {'name': 'Alice', 'age': 30, 'items': ['apple', 'banana', 'cherry']}
```

### Convert TOON to JSON String

```python
from json_toon import to_json_str

toon_text = """
name: Alice
age: 30
"""

json_string = to_json_str(toon_text)
print(json_string)
# Output: Pretty-printed JSON string
```

### Tables for Lists of Objects

```python
from json_toon import json_to_toon

users = [
    {"name": "Alice", "age": 30, "city": "NYC"},
    {"name": "Bob", "age": 25, "city": "LA"}
]

toon_string = json_to_toon(users)
print(toon_string)
# Output:
# name | age | city
# Alice | 30 | NYC
# Bob | 25 | LA
```

## API Reference

### `json_to_toon(data, indent=0)`
Convert Python object (dict, list, primitives) to TOON format string.

**Parameters:**
- `data`: Python object to convert
- `indent`: Starting indentation level (default: 0)

**Returns:** TOON-formatted string

### `toon_to_json(toon_text)`
Parse TOON-formatted text back into Python object.

**Parameters:**
- `toon_text`: TOON format string

**Returns:** Python object (dict, list, or primitive)

### `to_json_str(toon_text)`
Convert TOON text directly to JSON string.

**Parameters:**
- `toon_text`: TOON format string

**Returns:** Pretty-printed JSON string

## Development

To install in development mode:

```bash
pip install -e .
```

## License

MIT License - See LICENSE file for details.
damnit 0.2.1
The Data And Metadata iNspection Interactive Thing
Requires Python: >=3.10

# DAMNIT

[![Documentation Status](https://readthedocs.org/projects/damnit/badge/?version=latest)](https://damnit.readthedocs.io/en/latest/?badge=latest)
[![codecov](https://codecov.io/gh/European-XFEL/DAMNIT/graph/badge.svg?token=NGwo3ShLNw)](https://codecov.io/gh/European-XFEL/DAMNIT)

DAMNIT is a tool developed at the European XFEL to help users create an
automated overview of their experiment. Check out the documentation for more
information: https://damnit.rtfd.io

# Acknowledgements

This work is partially supported by the consortium
[DAPHNE4NFDI](https://www.daphne4nfdi.de/) in the context of the work of the
[NFDI e.V.](https://www.nfdi.de/). The consortium is funded by the Deutsche
Forschungsgemeinschaft ([DFG](https://www.dfg.de/), German Research Foundation)
- project number 460248799.