
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Replace UUIDs in your JSON files and JS objects with new UUIDs while preserving references.
json-cloak
provides a command-line interface for transforming JSON files, as well as a function to use in JavaScript projects to transform individual JS objects. Identical UUIDs are replaced with the same UUID.
The simplest way to use json-cloak
is to invoke via npx
:
npx json-cloak [options]
Alternatively, you can install json-cloak
globally as a CLI:
# npm
npm install -g json-cloak
# yarn
yarn global add json-cloak
Note: The npm package name is json-cloak
, however the globally installed binary name is just cloak
cloak [options]
-f, --file
: Specify the JSON file to transform.-i, --in-place
: Update the file in place with the transformed JSON object.-k, --keys
: Display the replaced keys instead of printing the transformed JSON object.-v, --version
: Display the version number.-p, --pattern
: Specify a glob pattern to operate on multiple files. This will perform updates in place!-q, --quiet
: Don't print to stdout-h, --help
: Show the help message.cloak -i -f data.json
cloak -k -f data.json
cloak -p 'test/*.json' -f other/dir/foo.json
cloak -v
In addition to being used as a CLI, json-cloak
can also be used inside JavaScript projects to transform individual JSON objects. Use either as CommonJS or ES6 module.
npm install json-cloak
or
yarn add json-cloak
// CommonJS
// const { cloak } = require('json-cloak')
// ES6
import { cloak } from 'json-cloak'
const user = {
id: 'a025c322-78af-4a23-8c27-e05a42be620e',
name: 'Javier',
age: 30,
friends: [
{
id: '80b96ced-ad77-4a9a-b758-a04e5988d093',
name: 'Sam',
age: 35,
friends: [
{
id: 'a025c322-78af-4a23-8c27-e05a42be620e',
name: 'Javier',
age: 30,
}
]
}
]
}
const transformedObject = cloak(user)
console.log(JSON.stringify(transformedObject, null, 2))
// {
// "id": "08cb9bb4-65b4-4706-88ef-97f97d208b37",
// "name": "Javier",
// "age": 30,
// "friends": [
// {
// "id": "6864205d-fcb2-49be-9c97-133379670e1a",
// "name": "Sam",
// "age": 35,
// "friends": [
// {
// "id": "08cb9bb4-65b4-4706-88ef-97f97d208b37",
// "name": "Javier",
// "age": 30
// }
// ]
// }
// ]
// }
Contributions are welcome, please open an issue or submit a pull request!
FAQs
Replace UUIDs in your JSON files
The npm package json-cloak receives a total of 4 weekly downloads. As such, json-cloak popularity was classified as not popular.
We found that json-cloak 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
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.