How can I use a .env in a JSON file?

I already have a .env file with my key in it, but right now I just need to be able to access it through the JSON file.

How can I do that?

You are viewing a single comment. View All

Hello, assuming you are coding in node.js, there is a very sneaky way to do it. First, do JSON.stringify() on the JSON file. For example:

Now, copy the output, and put it inside your .env file:

Now, anytime you want to access it,

Hopes this helps!