# Updating node with renamed default keys

**URL:** <https://discourse.nodered.org/t/updating-node-with-renamed-default-keys/81418>\
**Category:** Developing Nodes\
**Created:** [18 September 2023 15:24 UTC](https://discourse.nodered.org/t/updating-node-with-renamed-default-keys/81418 "2023-09-18T15:24:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![meijey](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/meijey/32/96575_2.png) [@meijey](https://discourse.nodered.org/u/meijey)\
**Post date:** [18 September 2023 15:24 UTC](https://discourse.nodered.org/t/updating-node-with-renamed-default-keys/81418/1 "2023-09-18T15:24:09Z")

</div>

Hi everybody,

while updating my custom node I noticed, that some of my default key names are not very accurate.

If I want to set the old value to the new key I have to keep the old key in defaults, otherwise the value is lost on startup (getting value by RED.nodes.node("xx"), while it still remains in the json file.

Is there a way to get the "old" node values without loading the json file separatly? ( I am sure a long time ago (Node-RED 1.x.x) has shown the old keys till deploying.)

I am using the latest version 3.1 currently.

E.g. -\> I want to rename "api" to "apiTag" and "api" should be deleted to keep the code clean.

node.html

```auto
  RED.nodes.registerType('openApi-red', {
    defaults: {
      name: { value: '', label: 'Name', placeholder: 'openApi-red', icon: 'tag' },
      // apiTag: { value: '', label: 'API tag' }, // new key 
      // api: { value: ''}, // old key which should be removed
      
     ....

     // change on startup
    RED.events.on('runtime-state', (msg) => {
    if (msg.state === 'start') {
           RED.nodes.eachNode(node => {
               if (node.type === 'my Node') node.apiTag = node.api
      }
    })

```

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [17 November 2023 15:24 UTC](https://discourse.nodered.org/t/updating-node-with-renamed-default-keys/81418/2 "2023-11-17T15:24:19Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
