Metadata-Version: 2.1
Name: Adon
Version: 1.0.0
Summary: Convert Python objects or JSON files to a compacter format!
Author: PatattMan
License: MIT License
        
        Copyright (c) 2023 ThereAre12Months
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/ThereAre12Months/Adon
Keywords: JSON,web,Adon
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: tomli; python_version < "3.11"

# Adon
 Adon is a faster, more efficient alternative to JSON

### Why would you use Adon instead of JSON?
 - Adon files are on average 1.4x smaller then a JSON file.
 - In Adon a lot of the limitations of JSON are gone. (any type can be used as a key in a dictionary)

# Usage
You can use Adon in the terminal and in a python script.

## Terminal
### Compiling JSON to Adon
You can compile JSON to Adon with the `adon -c` command, followed by the name of the JSON file and optionally the name of the Adon file.

`adon -c someFile.json someFile.adon`  
  -> compiles 'someFile.json' to 'someFile.adon'  

`adon -c otherFile.json`  
  -> compiles 'otherFile.json' to 'otherFile.adon'
***
### Decompiling Adon to JSON
You can decompile Adon to JSON using the `adon -d` command, followed by the Adon file and optionally the JSON file.  

`adon -d someFile.adon someFile.json`  
  -> decompiles 'someFile.adon' to 'someFile.json'

`adon -d otherFile.adon`  
  -> decompiles 'otherFile.adon' to 'otherFile.json'

## Python script
### Compiling Python Object to Adon
The Adon module has a function `dump()` that can be used to convert a Python object to a bytearray with Adon formatting.

```python
import adon

product = {
    "name": "Magic Wand",
    "price": 109.5,
    "available": True,
    "category": "magic"
}

obj = adon.dump(product)
```

This Adon object can than be used on its own, or it can be written to a file:
```python
with open("fileName.adon", "wb") as f:
    f.write(obj)
```

**Note that currently only strings, integers, floats, booleans, lists and dictionaries are supported.**
***

### Decompiling Adon back to Python Object
The Adon module also contains a function to revert the Adon back to a Python object.

```python
import adon

fruits = [
    "banana",
    "apple",
    "mango"
]

# convert to Adon
obj = adon.dump(someFruit)

# convert to Python object
val = adon.load(obj)

print(val) 
# ['banana', 'apple', 'mango']
```
