# Code node create Dynamic json

**URL:** <https://community.n8n.io/t/code-node-create-dynamic-json/173024>\
**Category:** Questions\
**Created:** [August 21, 2025, 11:29am UTC](https://community.n8n.io/t/code-node-create-dynamic-json/173024 "2025-08-21T11:29:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamal](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@jamal](https://community.n8n.io/u/jamal)\
**Post date:** [August 21, 2025, 11:29am UTC](https://community.n8n.io/t/code-node-create-dynamic-json/173024/1 "2025-08-21T11:29:12Z")

</div>

## Describe the problem/error/question

Dear,

I would like to have json result dynamically without knows name\_key and value as format, is it possible?:

```json
{
 "Agent": "A_AGENT", "ID":"ID_001", "Goal":"Goal n°1 Agent A","Words":'"phone number","email","address"'
}

```

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/5/4/547000abc577e684cea6f334639857fdbad17057.png)

Thank you.

## What is the error message (if any)?

## Please share your workflow

## Share the output returned by the last node

[  
{  
“mykey”: “A\_AGENT”  
},  
{  
“mykey”: “A\_AGENT”  
},

## Information on your n8n setup

- **n8n version: 1.106.3**
- **Database (default: SQLite):**
- **n8n EXECUTIONS\_PROCESS setting (default: own, main):**
- **Running n8n via (Docker, npm, n8n cloud, desktop app):Docker**
- **Operating system:Win10**

---

<div class="post-metadata">

**Author:** ![jabbson](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jabbson/32/87328_2.png) [@jabbson](https://community.n8n.io/u/jabbson)\
**Post date:** [August 21, 2025, 2:40pm UTC](https://community.n8n.io/t/code-node-create-dynamic-json/173024/2 "2025-08-21T14:40:33Z")

</div>

Could you please expand your explanation a little bit? It is not clear what you goal is? Do you want this to be randomly generated? Please explain what you want to do, what you want to happen, and what doesn’t work right now.

---

<div class="post-metadata">

**Author:** ![jamal](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@jamal](https://community.n8n.io/u/jamal)\
**Post date:** [August 21, 2025, 3:14pm UTC](https://community.n8n.io/t/code-node-create-dynamic-json/173024/3 "2025-08-21T15:14:41Z")

</div>

on my code, i have :

```javascript
result.push({
      "json":
        {
        
        mykey : items[index].json.Agent,
		// "aBrandNewField": "New data for item " + index
        },
      "pairedItem": index
  });

```

I must be declare theses :

Is it possible to have dynamic object with a loop key/value without set the real\_name of column on the code : list\_keys contains the list of key. Example, i set “Agent” : items[index].json.Agent → i would like to have : list\_keys[index]: items[index].json.[column\_number]

```javascript
result.push({
      "json":
        {
        
        "Agent" : items[index].json.Agent,
         "ID" : items[index].json.ID,
          "Goal":items[index].json.Goal,
          "Words":items[index].json.Words,
         
		// "aBrandNewField": "New data for item " + index
        },
      "pairedItem": index
  });

```

---

<div class="post-metadata">

**Author:** ![jabbson](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jabbson/32/87328_2.png) [@jabbson](https://community.n8n.io/u/jabbson)\
**Post date:** [August 21, 2025, 3:42pm UTC](https://community.n8n.io/t/code-node-create-dynamic-json/173024/4 "2025-08-21T15:42:20Z")

</div>

Take a look and let me know if this is something you are looking for:

---

<div class="post-metadata">

**Author:** ![jamal](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@jamal](https://community.n8n.io/u/jamal)\
**Post date:** [August 22, 2025, 6:38am UTC](https://community.n8n.io/t/code-node-create-dynamic-json/173024/5 "2025-08-22T06:38:41Z")

</div>

Yes, it’s my request, thank you.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [August 29, 2025, 6:39am UTC](https://community.n8n.io/t/code-node-create-dynamic-json/173024/6 "2025-08-29T06:39:04Z")

</div>

Closed on August 29, 2025, 6:39am UTC

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