Uses json_numpy
for transparent loads
and dumps
of lists into numpy-arrayrs if the dtype
is either purely int or float.
Recursively read (or write) .json
files in a tree of directories.
JSON-lines or .jsonl
is a powerful extension to the JSON-family.
import json_utils as ju
with ju.lines.open("my-items.jsonl.gz", mode="w|gz") as jl:
for i in range(100):
jl.write({"number": i})
with ju.lines.open("my-items.jsonl.gz", mode="r|gz") as jl:
for obj in jl:
print("item", obj["number"])