Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
美化终端中的JSON输出-Visual Studio代码-Python_Python_Json_Visual Studio Code - Fatal编程技术网

美化终端中的JSON输出-Visual Studio代码-Python

美化终端中的JSON输出-Visual Studio代码-Python,python,json,visual-studio-code,Python,Json,Visual Studio Code,我希望在VSC的终端中使JSON字符串的输出更漂亮 我目前正在venv中使用python 3.8.5 32位,以及最新版本的VSC。我已经安装了python和python扩展包。我试图美化JSON,但似乎没有任何效果 到目前为止,我已尝试使用: print(json.dumps(json.loads(response.text),sort_keys=True,indent=4,分隔符=(“,”,“:”))) 然而,这只会产生一个难以读取的大字符串 我是Python的相对初学者,最近几天才开始使用

我希望在VSC的终端中使JSON字符串的输出更漂亮

我目前正在venv中使用python 3.8.5 32位,以及最新版本的VSC。我已经安装了python和python扩展包。我试图美化JSON,但似乎没有任何效果

到目前为止,我已尝试使用:

print(json.dumps(json.loads(response.text),sort_keys=True,indent=4,分隔符=(“,”,“:”)))

然而,这只会产生一个难以读取的大字符串


我是Python的相对初学者,最近几天才开始使用VSC。

这是否回答了您的问题?
from pprint import pprint

pprint(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))