Skip to content

Enhancement: process each JSON Line separately #67

@smammy

Description

@smammy

I'd like to have a switch (say, -L) that would cause jello to evaluate QUERY once per JSON line in the input. I'm not sure if this would fit in with the jello philosophy, but it sure would help me eliminate CPython startup time (and shell boilerplate) while avoiding memory bloat.

I think the JSON Line is a natural chunk size, because it avoids the problem of having to specify the chunk size (cf. ijson's "prefix" handling).

Some contrived examples, in fish shell:

# OLD
for url in $my_data_urls
    curl $url | jello _.haystack.needle
end

# NEW
curl $my_data_urls | jello -L _.haystack.needle
# OLD
find . -type f -name \*.json -print0 | while read -z jsonfile
    cat $jsonfile | jello _.haystack.needle
end

# NEW
find . -type f -name \*.json -exec cat | jello -L _.haystack.needle

Think of it as analogous to Perl's -p switch if that helps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions