Convert Python objects or JSON files to a compacter format!
Project description
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)
Installation
Using pip:
python -m pip install adon
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.
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:
with open("fileName.adon", "wb") as f:
f.write(obj)
Note that currently only strings, integers, floats, booleans, NoneType, lists, tuples, dictionaries, bytearrays and bytes are supported.
Decompiling Adon back to Python Object
The Adon module also contains a function to revert the Adon back to a Python object.
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']
Versioning
1.0.2
- Performance improvements
- Reorganization
1.0.1
- Bytes + Bytearrays
1.0.0
- strings, integers, floats, booleans, NoneType, lists, tuples, dictionaries
dump()+load()functions
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 Adon-1.0.2.tar.gz.
File metadata
- Download URL: Adon-1.0.2.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0b3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c83f19cb7e39930b763c2b72e6609c3050281e4c840ebc6edd00cc597a26c7c
|
|
| MD5 |
60477c0f34e7f603af5d48a4caa78301
|
|
| BLAKE2b-256 |
4b287af841f32d113c92343d9c184ccdfa72bdef993b4b28aa6eabde95e826ef
|
File details
Details for the file Adon-1.0.2-py3-none-any.whl.
File metadata
- Download URL: Adon-1.0.2-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0b3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
068a426bfa4d09051da7c4d1fb764e184b38045b074d43a9716304cf80415695
|
|
| MD5 |
7c4bfd389027e856c6ab964b174d71a8
|
|
| BLAKE2b-256 |
efb48682d289dc22875d6b8b7df7c41b2df65d5d221ad860544fcf5f082554a6
|