A parser and serializer for WSON (Web Simple Object Notation)
Project description
WSON (Web Simple Object Notation)
WSON is a simple, readable data interchange format that combines the best features of JSON and YAML while addressing some of their limitations.
Features
- Simple and intuitive syntax
- Supports comments (both // and # styles)
- Preserves the original formatting when possible
- Easy to read and write for humans
- Supports nested objects and arrays
- Handles strings, numbers, booleans, and null values
Installation
You can install WSON using pip:
pip install wson
Usage
Here's a quick example of how to use WSON in your Python projects:
import wson
# Parse WSON string
wson_data = """
{
status = "success",
code = 200,
message = "Data retrieved successfully",
user = {
id = 123,
name = "John Doe",
email = "john@example.com",
age = 25
},
tasks = [
{
task_id = 1,
title = "Complete project report",
status = "in-progress",
due_date = "2024-10-15"
},
{
task_id = 2,
title = "Review team feedback",
status = "pending",
due_date = "2024-10-20"
}
]
}
"""
# Parse WSON to Python dictionary
parsed_data = wson.parse_wson(wson_data)
print(parsed_data)
# Serialize Python dictionary to WSON
wson_output = wson.serialize_wson(parsed_data)
print(wson_output)
Why WSON?
WSON addresses some limitations of JSON and YAML:
- Unlike JSON, WSON supports comments, making it more readable and self-documenting.
- WSON has a simpler syntax compared to YAML, reducing the chance of indentation errors.
- WSON preserves the original formatting when possible, unlike JSON which often alters the structure.
- WSON is more concise than JSON, omitting unnecessary quotation marks for keys.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License.
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 wson-0.1.0.tar.gz.
File metadata
- Download URL: wson-0.1.0.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbc1166bb9cfc93a494127ced0fe9f4013590575136524daf8f554e511c924e6
|
|
| MD5 |
d07fa6f6426f9c26e4223b68985ea843
|
|
| BLAKE2b-256 |
08f1a61caeb6c3ae63491294a09070c3fc724eb894d5aa50416fe4da129c654c
|
File details
Details for the file wson-0.1.0-py3-none-any.whl.
File metadata
- Download URL: wson-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09ccc1658174e526e2226e42d5d2a4c2b2c23cd66a3fef8b6c319d44697b7544
|
|
| MD5 |
23a2ea761e2249cbeb4b7823a110863c
|
|
| BLAKE2b-256 |
4e98d9e08941b9160ef21d16d3fd5bdf1bd819714672adc53f8c4d39e1c9486c
|