datapad.io.read_json#
- datapad.io.read_json(path_or_paths, lines=True, ignore_errors=False)#
Construct a Sequence from json text files
- Parameters:
path_or_paths – str or list of strings A path, or list of paths. Paths may contain glob patterns like “data/metadata-*-a.txt”
lines – bool (default: True) If True, each element of the sequence comes from decoding a line in the json-lines text file (see: http://jsonlines.org/examples/). If False, each element in sequence is obtained by running json.loads on the entire contents of the text file .
ignore_errors – bool If True, ignore and skip over any elements that present json load errors
>>> seq = read_json(["data/meta-*.json"], lines=True) >>> seq.collect() [{"dog": 1}, {"dog": 2}]