A robust JSON encoder that fixes errors by utilizing DFS algorithm.
Project description
DFS JSON
A Depth First Search powered JSON decoding library. For the remaining operations (dump, dumps), it uses standard python JSON library.
Installation
pip install dfsjson
Usage
# Create a complex JSON object
example_json = """{
"key1": "value1'
"key2": [1 2, 3]
"key3": {
"subkey1": "subvalue1"
"subkey2": "subvalue2"
,
}"""
dj = DFSJson(max_depth = 100, max_diff = 10)
dj.loads(example_json)
Discussion
Hey I know this. Why not have you used Breadth First Search?
Technically you are correct but keep in mind that Breadth First Search keeps the previous states in its list which scales with number of iterations you are making and it can be a huge strain on the memory.
However, Depth First search requires only O(log(n)) memory complexity in which we can search a lot more possibilities.
Contribution
Please don't hesitate to create issues and pull requests since this is developed overnight.
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 dfsjson-1.1.2.tar.gz.
File metadata
- Download URL: dfsjson-1.1.2.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77dae90fa3333a546c20243f073feabfe4030d2ebd6bc03bd407fe167062163f
|
|
| MD5 |
d20e8721a45e36977ec383eed0b9be5e
|
|
| BLAKE2b-256 |
49576b297fc1b16beb76e2f04375e51ec29b6a2bbf6c4c0eab5909b3b6d56a38
|
File details
Details for the file dfsjson-1.1.2-py3-none-any.whl.
File metadata
- Download URL: dfsjson-1.1.2-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fd850a75b03be581c00e39c7c7e996525fb4170313de1e3897bf7f912e68821
|
|
| MD5 |
772f478919a28794f549237432f6fced
|
|
| BLAKE2b-256 |
c2d84cd37680abad262d2838a5d6aa98e921a4e4d491cf709ea9a395c38c384f
|