New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gron

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gron

Python library to grep JSON.

  • 1.4.0
  • Source
  • PyPI
  • Socket score

Maintainers
1

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";

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc