
Security News
arXiv Is Rate Limiting Authors Following a Flood of AI Slop Submissions
arXiv now limits authors to two submissions a month as AI slop overwhelms moderators, delays good papers, and sparks debate over applying the limit to everyone.
A CLI tool to transform JSON files with custom JS functions
Features:
--diff optionnpm install --global json-apply
# Transform one json file at a time
json-apply some_transform_function.js some_data.json > some_data_transformed.json
# Transform many json files
json-apply -i some_transform_function.js *.json
where some_transform_function.js just needs to export a JS function. This should work both with the ESM export syntax
// some_transform_function.js
export default function (doc) {
doc.total = doc.a + doc.b
if (doc.total % 2 === 0) {
return doc
} else {
// returning null or undefined drops the entry
}
}
or with the CommonJS export syntax
// some_transform_function.js
module.exports = function (doc) {
doc.total = doc.a + doc.b
if (doc.total % 2 === 0) {
return doc
} else {
// returning null or undefined drops the entry
}
}
That function can also be async:
import { getSomeExtraData } from './path/to/get_some_extra_data.js'
// some_async_transform_function.js
export default async function (doc) {
doc.total = doc.a + doc.b
if (doc.total % 2 === 0) {
doc.extraData = await getSomeExtraData(doc)
return doc
} else {
// returning null or undefined drops the entry
}
}
As a way to preview the results of your transformation, you can use the diff mode
json-apply some_transform_function.js some_data.json --diff
which will display a colored diff of each line before and after transformation.
For more readability, each line diff output is indented and on several lines.
Given a function_collection.js file like:
// function_collection.js
export function foo (obj) {
obj.timestamp = Date.now()
return obj
}
export function bar (obj) {
obj.count += obj.count
return obj
}
You can use those subfunction by passing their key as an additional argument
json-apply function_collection.js#foo some_data.json
json-apply function_collection.js#bar some_data.json
This should also work with the CommonJS syntax:
// function_collection.cjs
module.exports = {
foo: (obj) => {
obj.timestamp = Date.now()
return obj
},
bar: (obj) => {
obj.count += obj.count
return obj
}
}
FAQs
A CLI tool to transform JSON files with custom JS functions
The npm package json-apply receives a total of 38 weekly downloads. As such, json-apply popularity was classified as not popular.
We found that json-apply 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.

Security News
arXiv now limits authors to two submissions a month as AI slop overwhelms moderators, delays good papers, and sparks debate over applying the limit to everyone.

Research
/Security News
A new GhostAction wave hits hundreds of GitHub repos, expanding CI/CD secret theft to cloud and AI credentials in source code and git history.

Research
/Security News
Tensorlake npm SDK version 0.5.144 was compromised in a ChainDrop / Shai-Hulud attack, delivering credential-stealing malware.