diff --git a/CHANGELOG b/CHANGELOG index 0e5bc37..ee3c356 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ jtbl changelog +20230114 v1.5.0 +- Be more tolerant of loading JSON Lines with blank lines and whitespace + 20221006 v1.4.0 - Add CSV (`-c`) table output option - Add HTML (`-H`) table output option diff --git a/jtbl/cli.py b/jtbl/cli.py index ec5ed41..5d47c6b 100644 --- a/jtbl/cli.py +++ b/jtbl/cli.py @@ -7,7 +7,7 @@ import tabulate import shutil -__version__ = '1.4.0' +__version__ = '1.5.0' SUCCESS, ERROR = True, False @@ -137,8 +137,9 @@ def get_json(json_data, columns=None): data_list = [] for i, jsonline in enumerate(data): try: - entry = json.loads(jsonline) - data_list.append(entry) + if jsonline.strip(): + entry = json.loads(jsonline) + data_list.append(entry) except Exception as e: # can't parse the data. Throw a nice message and quit return (ERROR, textwrap.dedent(f'''\ diff --git a/setup.py b/setup.py index 57c25ac..b45ff9c 100755 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name='jtbl', - version='1.4.0', + version='1.5.0', author='Kelly Brazil', author_email='kellyjonbrazil@gmail.com', description='A simple cli tool to print JSON and JSON Lines data as a table in the terminal.',