Skip to main content

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.

Release files for dfsjson 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dfsjson 1.1.2
File Size Uploaded
dfsjson-1.1.2.tar.gz 14.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dfsjson 1.1.2
File Interpreter ABI Platform
dfsjson-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size:29.9 kB

Release files / dfsjson-1.1.2.tar.gz

Download URL dfsjson-1.1.2.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
77dae90fa3333a546c20243f073feabfe4030d2ebd6bc03bd407fe167062163f
BLAKE2b-256 checksum
How to use checksums
49576b297fc1b16beb76e2f04375e51ec29b6a2bbf6c4c0eab5909b3b6d56a38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.16

Release files / dfsjson-1.1.2-py3-none-any.whl

Download URL dfsjson-1.1.2-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2fd850a75b03be581c00e39c7c7e996525fb4170313de1e3897bf7f912e68821
BLAKE2b-256 checksum
How to use checksums
c2d84cd37680abad262d2838a5d6aa98e921a4e4d491cf709ea9a395c38c384f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.16

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.11

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page