Skip to content

Instantly share code, notes, and snippets.

@Abathargh
Last active June 14, 2021 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Abathargh/20dbbc576ebc2911e300db1c9a9aee8f to your computer and use it in GitHub Desktop.
Save Abathargh/20dbbc576ebc2911e300db1c9a9aee8f to your computer and use it in GitHub Desktop.
Convert a .env properties file to json
import sys
prop = None
with open(sys.argv[1], "r") as f:
prop = f.read()
res = "{\n"
for line in prop.split("\n"):
if "=" in line:
name, value = line.split("=")
res += f'\t"{name}": "{value}",\n'
res = res[:-2]
res += "\n}"
print(res)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment