Describe the issue/error/question
Hello! I am super stuck. I have a list with 2 columns “Key” and “Values” . I need to make the values inside the column “Key” , the actual Key’s of the Json i want to send, and the values in the column “Values” the values of the corresponding keys… To clarify, here is an example:
[
{
"id": 22766366654681,
"namespace": "my_fields",
"key": "material",
"value": "Leather",
"description": null,
"owner_id": 7570081644761,
"created_at": "2022-02-28T14:19:34+01:00",
"updated_at": "2022-02-28T14:19:34+01:00",
"owner_resource": "product",
"type": "single_line_text_field",
"admin_graphql_api_id": "gid://shopify/Metafield/22766366654681"
},
{
"id": 22766366687449,
"namespace": "my_fields",
"key": "universe",
"value": "Women",
"description": null,
"owner_id": 7570081644761,
"created_at": "2022-02-28T14:19:34+01:00",
"updated_at": "2022-02-28T14:19:34+01:00",
"owner_resource": "product",
"type": "single_line_text_field",
"admin_graphql_api_id": "gid://shopify/Metafield/22766366687449"
},
{
"id": 22766366720217,
"namespace": "my_fields",
"key": "category",
"value": " ",
"description": null,
"owner_id": 7570081644761,
"created_at": "2022-02-28T14:19:34+01:00",
"updated_at": "2022-02-28T14:19:34+01:00",
"owner_resource": "product",
"type": "single_line_text_field",
"admin_graphql_api_id": "gid://shopify/Metafield/22766366720217"
},
I need this to output:
{
"Shopify Id": 7570081644761,
"material": "Leather",
"universe": "Women",
"category" : "",
}
I tried many things, mainly nesting IF statements and set nodes to identify the values and restructure the Json. but it didnt work…
Then i tried nesting merge nodes with the optiont of “merge outputs”, but it is super annoying because if one of the values is empty, the output will be empty, and if i use the “append” option, then since i do multiple levels of merging i end up with rows with the same ID at the end …
Important to note than I have 11 Keys so it is quite a long list of nested merging, and many times the values are empty
Please help! and LMK if something isnt clear ill be reactive!
thanks so much to whomever can help me
Here is my workflow:
Share the output returned by the last node
Information on your n8n setup
- n8n version:
- Database you’re using (default: SQLite):
- Running n8n with the execution process [own(default), main]:
- Running n8n via [Docker, npm, n8n.cloud, desktop app]: