# WSON (Web Simple Object Notation)

WSON is a new data serialization format designed to address the shortcomings of JSON and YAML.

[GitHub](https://github.com/LunaStev/wson)

# Syntax Definition
## 1. Basic Structure
* The contents of a WSON file are enclosed in curly baces `{}`, which represent an object.
* An object consists of key-value pairs.
* Keys and values are separated by either a colon (`:`) or an equals sign (`=`).

## 2. Comments
* Comments begin with `//` or `#` and are written on a single line.
* Comments apply until the end of the line.
* Multi-line comments are not supported; for comments spanning multiple lines, add `//` or `#` at the start of each line.

## 3. Object
* An object is enclosed in curly barces `{}` and contains key-value pairs.
* You can use either `:` or `=` between keys and values, and both symbols can be mixed within the same object
* Each attribute is separated by a comma `,`.
* Objects can be nested within other objects.

Example:
```
{
    status: "success",
    code = 200,
    user = {
        id: 123,
        name: "John Doe"
    }
}
```

## 4. Array
* Arrays are enclosed in square brackets `[]`, and elements are separated by commas `,`.
* Array elements can include objects, strings, numbers, and other data types.
* In WSON, arrays can be nested within objects, and arrays can contain other arrays or objects.

Example:
```
tasks: [
    {
        task_id: 1,
        title: "Complete project report"
    },
    {
        task_id: 2,
        title: "Review team feedback"
    }
]
```

## 5. Key-Value Pair
* Attribute names are strings and are followed by either `:` or `=`, with the value placed immediately after.
* Value types include strings, numbers, booleans, objects, and arrays.
* Strings are enclosed in double quotes `"`.
* Numbers are used without quotes and can be integers or floating-point values.

Example:
```
name: "John Doe"
age = 25
```

## 6. Data Types
* String: Text enclosed in double quotes `"`.
```
"hello world"
```
* Number: An integer or floating-point value.
```
42
3.14
```
* Boolean: Uses `true` or `false` valuse.
```
is_active = true
```
* Object: Key-value pairs enclosed in curly braces `{}`.
* Array: A list of elements enclosed in square brackets `[]`.

## 7. Example Explanation
```
{
    // Status code and message information
    status: "success",
    code: 200,
    message: "Data retrieved successfully",

    user = {
        id = 123,
        name: "John Doe",
        email: "john@example.com",
        age: 25  # User age
    },

    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"
        }
    ]
}
```
