{"id":13632,"library":"node-json-transform","title":"JSON Transformation Utility","description":"node-json-transform is a Node.js utility designed for declaratively transforming and performing operations on JSON data structures. Its last stable release is v1.1.2. The project appears to be abandoned, with no significant updates or releases in the past 8 years. It allows users to define a mapping schema to rename, restructure, and apply operations to JSON objects and arrays. Key features include path-based data retrieval (similar to `lodash.get`), custom functions for data manipulation via `operate` and `each` hooks, default value assignment for missing attributes, and specified attribute removal. It offers both synchronous and asynchronous transformation APIs, making it suitable for various data processing scenarios.","status":"abandoned","version":"1.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/bozzltron/node-json-transform","tags":["javascript","json","transform","node"],"install":[{"cmd":"npm install node-json-transform","lang":"bash","label":"npm"},{"cmd":"yarn add node-json-transform","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-json-transform","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CommonJS-only and does not natively support ES Modules. Use `require`.","wrong":"import { transform } from 'node-json-transform';","symbol":"transform","correct":"const { transform } = require('node-json-transform');"},{"note":"CommonJS-only. The asynchronous version returns a Promise.","wrong":"import { transformAsync } from 'node-json-transform';","symbol":"transformAsync","correct":"const { transformAsync } = require('node-json-transform');"},{"note":"To access both `transform` and `transformAsync`, it's common to require the entire module and access properties.","wrong":"import jsonTransform from 'node-json-transform';","symbol":"All exports (common pattern)","correct":"const jsonTransform = require('node-json-transform');\nconst result = jsonTransform.transform(data, map);"}],"quickstart":{"code":"const { transform, transformAsync } = require('node-json-transform');\n\nconst data = {\n  title : 'title1',\n  description: 'description1',\n  blog: 'This is a blog.',\n  date: '11/4/2013',\n  extra : {\n    link : 'http://goo.cm'\n  },\n  list1:[\n    {\n      name:'mike'\n    }\n  ],\n  clearMe: 'text'\n};\n\nconst map = {\n  item: {\n    name: 'title',\n    info: 'description',\n    text: 'blog',\n    date: 'date',\n    link: 'extra.link',\n    item: 'list1.0.name',\n    clearMe: '', // Clears the attribute\n    fieldGroup: ['title', 'extra'] // Creates an array from specified fields\n  },\n  operate: [\n    {\n      run: 'Date.parse', on: 'date' // Runs Date.parse on the 'date' field\n    },\n    {\n     run: function(val) { return val + ' more info'}, on: 'info' // Custom function on 'info'\n    }\n  ],\n  each: function(item){ // Runs after mapping and operations on each item\n    item.iterated = true;\n    return item;\n  }\n};\n\n// Synchronous transformation\nconst syncResult = transform(data, map);\nconsole.log('Synchronous Result:', JSON.stringify(syncResult, null, 2));\n\n// Asynchronous transformation\ntransformAsync(data, map).then(asyncResult => {\n  console.log('Asynchronous Result:', JSON.stringify(asyncResult, null, 2));\n});\n","lang":"javascript","description":"This quickstart demonstrates both synchronous and asynchronous JSON transformations, including remapping fields, applying built-in and custom functions, and iterating over each transformed item."},"warnings":[{"fix":"Consider migrating to a more actively maintained JSON transformation library or implement custom transformation logic.","message":"The `node-json-transform` project appears to be abandoned, with no updates or security patches in over 8 years. It is not recommended for new projects or environments requiring active maintenance and security vigilance.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always use `require()` syntax for importing, e.g., `const { transform } = require('node-json-transform');`.","message":"This package is CommonJS-only and does not provide native ES Module (ESM) support. Attempting to use `import` statements directly will result in errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Create a `node-json-transform.d.ts` file with basic type declarations for `transform` and `transformAsync`.","message":"The library does not ship with TypeScript type definitions. Users working in TypeScript projects will need to create their own declaration files (`.d.ts`) or use `@ts-ignore` to suppress type errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Sanitize or validate transformation maps thoroughly if they originate from untrusted sources. Avoid directly exposing map creation to end-users.","message":"The `operate` and `each` fields in the map schema allow custom functions to be executed, which can be a security risk if the transformation map is sourced from untrusted user input, as it permits arbitrary code execution.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'8':44 'abandon':34 'allow':47 'api':103 'appear':31 'appli':58 'array':64 'assign':88 'asynchron':101 'attribut':91,94 'base':70 'custom':76 'data':21,71,79,109 'declar':14 'default':86 'defin':50 'design':12 'featur':66 'function':77 'hook':85 'includ':67 'javascript':112 'json':1,6,20,61,113 'key':65 'last':24 'lodash.get':75 'make':104 'manipul':80 'map':52 'miss':90 'node':5,115 'node-json-transform':4 'node.js':10 'object':62 'offer':97 'oper':18,59,82 'past':43 'path':69 'path-bas':68 'perform':17 'process':110 'project':30 'releas':26,40 'remov':95 'renam':55 'restructur':56 'retriev':72 'scenario':111 'schema':53 'signific':37 'similar':73 'specifi':93 'stabl':25 'structur':22 'suitabl':106 'synchron':99 'transform':2,7,15,102,114 'updat':38 'user':48 'util':3,11 'v1.1.2':28 'valu':87 'various':108 'via':81 'year':45","created_at":"2026-04-20T01:55:30.299823+00:00","updated_at":"2026-04-20T01:55:30.299823+00:00","problems":[{"fix":"Change `import { transform } from 'node-json-transform';` to `const { transform } = require('node-json-transform');`.","cause":"Attempting to import `transform` using ES Module `import` syntax instead of CommonJS `require`.","error":"TypeError: transform is not a function"},{"fix":"Run `npm install node-json-transform` in your project directory.","cause":"The package has not been installed, or there's a typo in the package name during import/require.","error":"Error: Cannot find module 'node-json-transform'"},{"fix":"Ensure `const { transformAsync } = require('node-json-transform');` is used, or access it via `const jsonTransform = require('node-json-transform'); jsonTransform.transformAsync(...)`.","cause":"Trying to use `transformAsync` directly without destructuring or accessing it from the required module object.","error":"UnhandledPromiseRejectionWarning: TypeError: transformAsync is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/bozzltron/node-json-transform","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/node-json-transform","openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}