Skip to main content

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:

  1. Unlike JSON, WSON supports comments, making it more readable and self-documenting.
  2. WSON has a simpler syntax compared to YAML, reducing the chance of indentation errors.
  3. WSON preserves the original formatting when possible, unlike JSON which often alters the structure.
  4. 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


Download files

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

Source Distribution

wson-0.1.3.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

wson-0.1.3-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file wson-0.1.3.tar.gz.

File metadata

  • Download URL: wson-0.1.3.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for wson-0.1.3.tar.gz
Algorithm Hash digest
SHA256 af56497eccbb18762b61d75123c8dbca106edaa0814c8aeedd01accc2ab35a9c
MD5 a5c11e5d142a3b461b06d6807189eb17
BLAKE2b-256 94d53bb63d340bb289d034ea761bd8004b87925cb6b4b94065e40a9799c81da7

See more details on using hashes here.

File details

Details for the file wson-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: wson-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for wson-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9e991047a3955209e078b85d44f17982a7cf0ace38f949e610eb54e0ab24e5c6
MD5 45b7e6088cd2c0ea9c98cd6c0752dc71
BLAKE2b-256 509b37834da9b1159e19ccb6130f8d4f646bfeb494c0d10abe6996b18051b825

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