
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
transcribe-json
Advanced tools
npm install transcribe-json
Three basic functions:
import { read, extract, write } from "transcribe-json";
read is async and returns the JSON file content as an object.extract returns a function that extracts fields from any object (only top-level fields can be specified).write returns an async function that write an object to a file in JSON, ES Module or CommonJS.You can combine them as follows:
// just read and use it as you like later
const content = await read(srcfile);
// copy all fields to another file
read(srcfile).then(write(outfile));
// extract some fields
read(srcfile).then(extract(fields)).then(write(outfile));
// insert any callback to convert an object to another
read(srcfile).then(convert).then(write(outfile));
There are also some options for write():
write(outfile, {
replacer: null, // used in JSON.stringify()
space: " ", // used in JSON.stringify()
filetype: "json", // "json", "mjs" or "cjs"
formatter: (code, filetype) => code, // any formatting function
});
If filetype === "mjs", the result will be a default export.
export default {
"name": "transcribe-json",
"version": "0.1.0-alpha"
};
Use transcribe-json command.
Command:
transcribe-json [options] <input filepath>
transcribe-json <-h|--help|-v|--version>
Options:
--outfile <path> The output filepath with or without extension. (required)
--type <type> The filetype to emit. Either json, mjs or cjs. (optional)
--fields <names> Top-level field names to extract. Comma separated. (optional)
For example in your package.json:
{
"scripts": {
"pkg": "transcribe-json package.json --outfile package-info.js --type mjs --fields name,version"
}
}
FAQs
From JSON file to object. Extract any fields. From object to JS/JSON file.
We found that transcribe-json demonstrated a not healthy version release cadence and project activity because the last version was released 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
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.