Skip to content

Instantly share code, notes, and snippets.

@narenaryan
Created September 17, 2022 10:58
Show Gist options
  • Save narenaryan/080655e1d6867acaa01032677e038268 to your computer and use it in GitHub Desktop.
Save narenaryan/080655e1d6867acaa01032677e038268 to your computer and use it in GitHub Desktop.
import json
colors = [
{
"name": "RED",
"foundIn": "soil"
},
{
"name": "GREEN",
"foundIn": "forest"
},
{
"name": "Blue",
"foundIn": "sky"
}
]
str = json.dumps(colors, indent=2)
"""
Prints:
[
{
"name": "RED",
"foundIn": "soil"
},
{
"name": "GREEN",
"foundIn": "forest"
},
{
"name": "Blue",
"foundIn": "sky"
}
]
"""
print(str)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment