An attempt to recreate the way json behaves in Javascript, but in Python
Project description
Classy-Json
An attempt at recreating the way json works in JavaScript, but in the Python programming language.
How do I use Classy-Json?
- All functions from the built in json module are supported! json module docs
- The only difference is that you can now access dictionaries via
dict.key
as well asdict['key']
- Note: using
dict.key
is about 2-2.5x slower [in some cases] than usingdict['key']
, however, usingdict['key']
is just as fast as in normal Python dictionaries. - You can also use
classyjson.classify(Union[dict, list, actually anything])
to turn a preexisting dictionary or list into a ClassyDict or ClassyList object
Example Usage
import classyjson as cj
# load data from a json file
with open('tests/test_large.json', 'r') as f:
data = cj.load(f)
# turn a regular dictionary into a ClassyDict
my_dict = {'a': 'b'}
my_classy_dict = cj.classify(my_dict)
# or
my_classy_dict = cj.ClassyDict(my_dict)
# make a new ClassyDict
new_classy_dict = cj.ClassyDict()
Setup / Install
Using pip:
python3 -m pip install classy-json
Manually:
- Clone the repository
git clone https://github.com/Iapetus-11/classy-json.git
- cd into the directory
cd classy-json
- Run setup.py
python3 setup.py build install
Contribution
- Fork the repository
- Make any changes
- Submit a pull request
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
classy-json-2.3.0.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for classy_json-2.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 808d7a113443e76897472b94936b617b37209499fa8f437183a27cf93d586f37 |
|
MD5 | 9b93e68f92aa06e2dc417369cc209e42 |
|
BLAKE2b-256 | 996e7379b5da08ab6627d71db9fd020e9a2f4001e0edab06dacfddc8b9f4d921 |