summaryrefslogtreecommitdiffstats
path: root/Lib/json
diff options
context:
space:
mode:
authorwim glenn <hey@wimglenn.com>2019-12-06 06:44:01 (GMT)
committerInada Naoki <songofacandy@gmail.com>2019-12-06 06:44:01 (GMT)
commitefefe25443c56988841ab96cdac01352123ba268 (patch)
tree7154408936969702c8e86a8e8fd9dbf2985fa9fe /Lib/json
parentd863ade0c7fa4826e8b71aa467809c83a711f019 (diff)
downloadcpython-efefe25443c56988841ab96cdac01352123ba268.zip
cpython-efefe25443c56988841ab96cdac01352123ba268.tar.gz
cpython-efefe25443c56988841ab96cdac01352123ba268.tar.bz2
bpo-27413: json.tool: Add --no-ensure-ascii option. (GH-17472)
Diffstat (limited to 'Lib/json')
-rw-r--r--Lib/json/tool.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/json/tool.py b/Lib/json/tool.py
index 2a404a4..5542ce4 100644
--- a/Lib/json/tool.py
+++ b/Lib/json/tool.py
@@ -30,6 +30,8 @@ def main():
default=sys.stdout)
parser.add_argument('--sort-keys', action='store_true', default=False,
help='sort the output of dictionaries alphabetically by key')
+ parser.add_argument('--no-ensure-ascii', dest='ensure_ascii', action='store_false',
+ help='disable escaping of non-ASCII characters')
parser.add_argument('--json-lines', action='store_true', default=False,
help='parse input using the jsonlines format')
group = parser.add_mutually_exclusive_group()
@@ -49,6 +51,7 @@ def main():
dump_args = {
'sort_keys': options.sort_keys,
'indent': options.indent,
+ 'ensure_ascii': options.ensure_ascii,
}
if options.compact:
dump_args['indent'] = None