Skip to content

Commit 63dd807

Browse files
authored
Update json2yaml.py
1 parent 34774f5 commit 63dd807

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

Scripts/Miscellaneous/json2yaml/json2yaml.py

+7-10
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,12 @@ def getJSONValueFromFile(jsonPath):
2525
with open(jsonPath, "r") as jsonFile:
2626
return load(jsonFile)
2727

28-
jsonValue = getJSONValueFromFile(jsonPath)
29-
30-
# from line 36 to 38
28+
if __name__ == "__main__":
3129
# I opened (and created if not done) the yaml destination file
3230
# after that I dumped the dict into the yamlFile through pyyaml
33-
# after that I closed the csv file
34-
35-
yamlFile = open(yamlPath, "w")
36-
dump(jsonValue, yamlFile)
37-
yamlFile.close()
38-
39-
print(f"done, your file is now on {yamlPath}")
31+
# after that I closed the csv file
32+
jsonValue = getJSONValueFromFile(jsonPath)
33+
yamlFile = open(yamlPath, "w")
34+
dump(jsonValue, yamlFile)
35+
yamlFile.close()
36+
print(f"done, your file is now on {yamlPath}")

0 commit comments

Comments
 (0)