<commit_before># Buggy

> A bash-friendly JSON parser

## About

Buggy converts JSON into a flat structure with keys that can easily be handled by bash.

For example, the following JSON:

    {
        "hello": [
            "world": {
                "planet": "earth"
            },
            "everything"
        ]
    }

Is converted into a set of key-value pairs with the following keys:

* hello.world.planet
* hello.everything

## Usage

To output a list of the keys:

    cat test.json | buggy

Or to get a specific value:

    cat test.json | buggy "hello.world.planet"

Or you can output the keys and values together (this could be tricky to parse depending on the data):

    cat test.json | buggy --values

*Note: When using --values, the values will be converted into bash-friendly form.*

## Examples

A simple way to iterate over the keys and values in some json:

    for key in $(cat test.json | buggy); do
        value=$(cat test.json | buggy "$key")

        echo "The key '$key' has the value '$value'"
    done
<commit_msg>Tweak the docs<commit_after># Buggy

A bash-friendly JSON parser

## About

Buggy converts JSON into a flat structure with keys that can easily be handled by bash.

For example, the following JSON:

    {
        "hello": [
            {
                "world": "earth"
            },
            "everything"
        ]
    }

Is converted into a set of key-value pairs with the following keys:

* hello.0.world
* hello.1

## Usage

To output a list of the keys:

    cat test.json | buggy

Or to get a specific value:

    cat test.json | buggy "hello.0.world"

Or you can output the keys and values together (this could be tricky to parse depending on the data):

    cat test.json | buggy --values

*Note: When using --values, the values will be converted into bash-friendly form.*

## Examples

A simple way to iterate over the keys and values in some json:

    for key in $(cat test.json | buggy); do
        value=$(cat test.json | buggy "$key")

        echo "The key '$key' has the value '$value'"
    done

{'fraction_non_alphanumeric': 0.08624031007751938, 'fraction_numerical': 0.0014534883720930232, 'mean_word_length': 2.3908045977011496, 'pattern_counts': {'":': 5, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2288814', 'n_tokens_mistral': 625, 'n_tokens_neox': 584, 'n_words': 275}