'Python Dump Hsjon with comments
Dumping with hjson
Hello, i have a json which looks like this:
{
//yee
"ea": "sports", # sheesh
}
my py looks like this:
import hjson
with open("generator.json") as file:
content = hjson.load(file)
content["test"] = "ea"
with open("generator.json", "w") as file:
content = hjson.dumps(content, file)
but now, the json looks like
{
"ea": "sports",
"test": "ea"
}
even though i want
{
//yee
"ea": "sports", # sheesh
"test": "ea"
}
how can i do that?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
