{ "kind": "open-flow-workflow", "version": 1, "name": "Rename JSON Key", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_ff6a03b9750603fa": { "name": "Enter a JSON object", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "record" } ] }, "n_7991199ec200934c": { "inputs": { "record": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_ff6a03b9750603fa", "output": "record" } ] } }, "name": "Rename key to newkey", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "record" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "record" } ], "name": "Rename key to newkey", "moduleId": "n_c0472764184b279d", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_b696eb28ff2a7a22": { "name": "Renamed JSON object", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "record" } ], "outputMappings": { "record": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_7991199ec200934c", "output": "record" } ] } } } }, "edges": [ { "source": "n_ff6a03b9750603fa", "target": "n_7991199ec200934c" }, { "source": "n_7991199ec200934c", "target": "n_b696eb28ff2a7a22" } ] } }, "modules": { "n_c0472764184b279d": { "name": "Rename key to newkey", "imports": [], "source": "export default function renameExampleKey({ record }) {\n if (!record || typeof record !== 'object' || Array.isArray(record)) throw new Error('Enter a JSON object');\n const renamed = { ...record };\n if (Object.hasOwn(record, 'key')) {\n renamed.newkey = record.key;\n delete renamed.key;\n }\n return { record: renamed };\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }