https://github.com/bryanberger/python-json-size
Really simple way to get a sense for how large an array of json objects might be
https://github.com/bryanberger/python-json-size
json python
Last synced: about 2 months ago
JSON representation
Really simple way to get a sense for how large an array of json objects might be
- Host: GitHub
- URL: https://github.com/bryanberger/python-json-size
- Owner: bryanberger
- Created: 2020-03-02T16:25:16.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-02T17:07:35.000Z (over 6 years ago)
- Last Synced: 2025-10-11T00:34:53.661Z (9 months ago)
- Topics: json, python
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple json object array byte size estimator
## Why?
I wanted to estimate the size of the JSON output of an array full of the same object.
## How To
- open `json_size.py`
- edit the `numItems` to account for how many items to estimate.
- edit the object to duplicate.
## Run
```
$ python json_size.py
```
## Output
This script outputs the mock json, minified json, and gzipped json into a local `output` folder:
```
Number of Items 1000
Estimated Size: 108KB
Actual Size: 108KB
Estimated Minified Size: 80KB
Actual Minified Size: 80KB
Estimated Gzip Size: 48KB
Actual Gzip Size: 2KB
```
#### Credits
Based on the SO answer here: https://stackoverflow.com/a/39047897