Python library to grep JSON.
Project description
python-gron
Make JSON grep-able, a Python implementation of gron.
Installation
gron
is available on PyPi, to install it
use:
$ pip install gron
Documentation
The API documentation can be found here.
Usage
Given a JSON file with the content:
{
"one": 1,
"two": 2.2,
"three-b": "3",
"four": [1,2,3,4],
"five": {
"alpha": ["fo", "fum"],
"beta": {
"hey": "How's tricks?"
}
},
"abool": true,
"abool2": false,
"isnull": null,
"id": 66912849
}
you can use gron
like this:
$ gron tests/data/one.json
json = {};
json.abool = true;
json.abool2 = false;
json.five = {};
json.five.alpha = [];
json.five.alpha[0] = "fo";
json.five.alpha[1] = "fum";
json.five.beta = {};
json.five.beta.hey = "How's tricks?";
json.four = [];
json.four[0] = 1;
json.four[1] = 2;
json.four[2] = 3;
json.four[3] = 4;
json.id = 66912849;
json.isnull = null;
json.one = 1;
json.two = 2.2;
json["three-b"] = "3";``
Without any arguments gron
will read from STDIN
:
$ cat tests/data/one.json | gron
json = {};
json.abool = true;
json.abool2 = false;
json.five = {};
json.five.alpha = [];
json.five.alpha[0] = "fo";
json.five.alpha[1] = "fum";
json.five.beta = {};
json.five.beta.hey = "How's tricks?";
json.four = [];
json.four[0] = 1;
json.four[1] = 2;
json.four[2] = 3;
json.four[3] = 4;
json.id = 66912849;
json.isnull = null;
json.one = 1;
json.two = 2.2;
json["three-b"] = "3";
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
gron-1.4.0.tar.gz
(5.0 kB
view details)
Built Distribution
gron-1.4.0-py3-none-any.whl
(5.5 kB
view details)
File details
Details for the file gron-1.4.0.tar.gz
.
File metadata
- Download URL: gron-1.4.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3dacfa829b6ddf27d27d51a30fae0000d7fe6556ba0676cb6951825b80007053 |
|
MD5 | 74c6fd85b28a184215201fd80c305418 |
|
BLAKE2b-256 | a5e693f50418b75649725b1ab0e6226a6c193e82a7eadcb59308721038c4e245 |
File details
Details for the file gron-1.4.0-py3-none-any.whl
.
File metadata
- Download URL: gron-1.4.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ed6a56fc9ac7b61f9d96be6bf54cda1db061bd2e721183c5ed796f630adcf3c |
|
MD5 | c651f8f50413b42a1242b5fcdd733e5b |
|
BLAKE2b-256 | d9b50ef1807a4f0a8f73bb344c52a102140359a4ab3441f9a808e1b3de199c70 |