Skip to main content
Dev Tools

JSON to .env Converter

Put a Google service account key, Firebase config or any JSON into an environment variable, on one line.

Runs in your browser. Your key is never uploaded, stored or tracked.

Paste into a .env file, replacing any old line with the same name.

Result

The converted value appears here.

Reading it in your code

const key = JSON.parse(process.env.JSON_CONFIG!);

Frequently Asked Questions

Is my key uploaded anywhere?

No. The conversion runs in your browser with plain JavaScript. The JSON you paste or choose is never sent to a server, stored, or recorded by analytics.

Why does a service account key need converting?

A .env file holds one value per line, but a downloaded key spans many lines. This tool puts the whole key on one line and keeps the private key's line breaks as \n escapes, which your code turns back into real line breaks when it parses the JSON.

Which format should I pick?

Use the .env line for a local .env file. Use the one-line value for Vercel, Netlify, Railway or any dashboard with a separate name and value field. Use Base64 when a platform rejects quotes or braces; decode it in your code first. Use the shell export to set the variable in a terminal session.

How do I read the variable in my code?

Parse it as JSON. In Node.js: JSON.parse(process.env.GOOGLE_SERVICE_ACCOUNT_KEY). For the Base64 version: JSON.parse(Buffer.from(process.env.GOOGLE_SERVICE_ACCOUNT_KEY, "base64").toString()).

Does it work with Firebase configs and other JSON?

Yes. Any valid JSON works. Service account keys get extra checks, so a damaged or incomplete key is caught before you paste it into a deploy.