在 Python 中,你可以使用 json.dumps() 函数将 JSON 对象转换为字符串。以下是一个示例:

import json

# JSON 对象
data = {
  'name': 'John',
  'age': 30,
  'city': 'New York'
}

# 将 JSON 对象转换为字符串
json_string = json.dumps(data)

print(json_string)

输出:

{'name': 'John', 'age': 30, 'city': 'New York'}
Python 将 JSON 对象转换为字符串