PrettyPrint following JSON data with indent level 2 and key-value separators should be (",", " = ").
(",", " = ")
sampleJson = {"key1": "value1", "key2": "value2"}
Expected Output:
{ "key1" = "value2", "key2" = "value2", "key3" = "value3" }
Solution:
import json sampleJson = {"key1" : "value2", "key2" : "value2", "key3" : "value3"} prettyPrintedJson = json.dumps(sampleJson, indent=2, separators=(",", " = ")) print(prettyPrintedJson)
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Solution:
need an explanation for this answer? contact us directly to get an explanation for this answer