Created
March 17, 2018 15:57
-
-
Save zazazack/2753e07d6a35b9f97d7b55e339d2f253 to your computer and use it in GitHub Desktop.
Load JSON from multiple `.json` files stored in the JSON Lines format with Python 3.6 builtins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
import json | |
p = Path() # assuming .json files are located in the current working directory | |
data = [json.loads(line) for file in p.glob('*.json') for line in file.read_text().splitlines()] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I developed this method to import JSON Lines formatted data generated by a Scrapy application I built.