bpo-31553: add --json-lines option to json.tool (#10051)
* add jsonlines option to json.tool
* code review
* fix:avoid read infile after it close
* improve doc in whatsnew 3.8
diff --git a/Doc/library/json.rst b/Doc/library/json.rst
index 510e307..589e86c 100644
--- a/Doc/library/json.rst
+++ b/Doc/library/json.rst
@@ -717,6 +717,12 @@
.. versionadded:: 3.5
+.. cmdoption:: --json-lines
+
+ Parse every input line as separate JSON object.
+
+ .. versionadded:: 3.8
+
.. cmdoption:: -h, --help
Show the help message.
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index 51aee1b..3bacbab 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -151,6 +151,12 @@
The changes above have been backported to 3.7 maintenance releases.
+json.tool
+---------
+
+Add option ``--json-lines`` to parse every input line as separate JSON object.
+(Contributed by Weipeng Hong in :issue:`31553`.)
+
os.path
-------