.env and JSON
Turn a .env file into JSON and back, quoting and escaping included.
Result
Good to know
- Quotes decide how much of the line is the value. Double quotes process \n and \t; single quotes and backticks keep every character exactly as written.
- A quoted value may run over several lines, which is how a private key ends up in one of these files. An unquoted one ends at the first # that follows a space.
- There is no specification for this format, only the behaviour of the loaders that read it: dotenv, docker-compose and the shell agree on most of it and part company at the edges.
- Everything happens in your browser. A .env file usually holds credentials, and none of what you paste leaves this page.
32 views