#!/usr/bin/python3 # -*- coding: utf-8 -*- import json data = {'name':'张森','email':'zhangsen@qq.com'} data = json.dumps(data, sort_keys=True, indent=2) data = data.encode('utf-8').decode('unicode_escape') print(data)