Embedding whole JSON objects

Hello I am running into a hurdle when trying to generate embeddings. If I get multiple rows from supabase I end up with something like this:
[
{
“person”: “mike”,
“location”: “Seattle”,
“favoriteColor”: “blue”
},
{
“person”: “Jane”,
“location”: “Tokyo”,
“favoriteColor”: “red”
},
{
“person”: “andrea”,
“location”: “Paris”,
“favoriteColor”: “black”
},
{
“person”: “Lindsay”,
“location”: “Toronto”,
“favoriteColor”: “green”
}
]

So I have 4 objects from 4 rows in supabase. Great. I want to embed each entire object. Not just the values, and not just single values. To be clear I am trying to generate one embedding per object, and ideally the labels would be included. In my mind it seems like it should be easy to convert a json object to text, or to tell the default data loader how to handle the incoming data but neither of these things seem doable. If I run the above data into the Supabase vector store it sees 4 items and then generates 10-20 embeddings (depending on how I monkey with it). I just want to generate 4 embeddings. One for each object.

I have tried a number of different things but I feel like I am missing something obvious. Any help would be appreciated.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

I solved this with code. A bit of a disappointment as this is meant to be a no code platform, but hey at least I could get it done. Here is the code in case it will help someone else.

///

const myJSON = JSON.stringify($input.item.json);

const dataz = {“stringyJSON”: myJSON};

return dataz;

///

Welcome to the community @hakanai !

Tip for sharing information

Pasting your n8n workflow


Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.

```
<your workflow>
```

That implies to any JSON output you would like to share with us.

Make sure that you have removed any sensitive information from your workflow and include dummy or pinned data with it!


n8n doesn’t position itself as “no code”, n8n is “low code”.

As for the solution you found, I can suggest an alternative with less code if that is what you prefer.

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