Skip to content

Instantly share code, notes, and snippets.

@RealYukiSan
Created June 7, 2024 01:16
Show Gist options
  • Save RealYukiSan/e36abc3a8b329fdf0511d7cecfdfae5b to your computer and use it in GitHub Desktop.
Save RealYukiSan/e36abc3a8b329fdf0511d7cecfdfae5b to your computer and use it in GitHub Desktop.
prettfy jsonl with python
import json
import collections
with open('./test.jsonl', 'r') as json_file:
json_list = list(json_file)
for json_str in json_list:
result = json.loads(json_str, object_pairs_hook=collections.OrderedDict)
result = json.dumps(result, indent=4)
print(f"\n{result}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment