Created
June 7, 2024 01:16
-
-
Save RealYukiSan/e36abc3a8b329fdf0511d7cecfdfae5b to your computer and use it in GitHub Desktop.
prettfy jsonl with python
This file contains 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
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