separators
` parameter to change the default separators in the `json.dumps()
` function :import json
# create a dictionary
data = {
"name": "John",
"age": 30,
"city": "New York"
}
# convert the dictionary to a JSON string
json_string = json.dumps(data, indent=4, separators=(". ", " = "))
# print the JSON string
print(json_string)
{
"name" = "John".
"age" = 30.
"city" = "New York"
}
separators
` parameter is set to `(". ", " = ")
`, which means that a period followed by a space will be used to separate the keys and values, and an equals sign followed by a space will be used to separate the key-value pairs.