
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
base64tojson
Advanced tools
Decode a Base64-encoded JSON string into a JavaScript object.
Perfect for decoding API payloads, tokens, or embedded data.
npm install base64tojson
yarn add base64tojson
const base64tojson = require("base64tojson");
(async () => {
const jsonData = { name: "Yunus", age: 28 };
const base64 = Buffer.from(JSON.stringify(jsonData)).toString("base64");
try {
const result = await base64tojson(base64);
console.log(result); // { name: 'Yunus', age: 28 }
} catch (err) {
console.error("Invalid base64 or JSON:", err);
}
})();
This function takes a single Base64-encoded string. No options object required.
Parameter | Type | Required | Description |
---|---|---|---|
base64Data | string | ✅ | A Base64-encoded string of a JSON blob |
If successful, it returns a JavaScript object parsed from the JSON content.
If invalid Base64 or JSON, it throws an error.
node test.js
MIT
FAQs
Decodes a Base64-encoded JSON string into a JavaScript object
We found that base64tojson demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.