String to Array for API request

Hi

I want to send API request to Qdrant for hybrid retrieval. To do this, I need to send proper array of vectors, but everytime I upload this {{ $json.data[0].embedding }}, even it is an Array in input, it changes to string in output - and it makes error. I can’t find way how to send my {{ $json.data[0].embedding }} like array values - proper format for this api request.

What is the error message (if any)?

Bad request - please check your parameters

400 - {“status”:{“error”:“Format error in JSON body: Expected some form of vector, id, or a type of query at line 1 column 13012”},“time”:0}

Share the output returned by the last node

expected output:

query = [-0.043787975, 0.03704786,-0.08570875, 0.009757226, …1

Information on your n8n setup

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

Hey @Robert_Macku hope all is well, welcome to the community.
Could you try to surround you {{ $json.data[0].embedding }} with square brackets instead of double quotes? API expects this to be an array of integers. Like so:

"query": [{{ $json.data[0].embedding }}]

Hi, thank you :slight_smile:

Unfortunately, it doesn’t work. It is still string. :confused: I think it must be some solution here, but I absolutely don’t know, I try lot of thinks, but nothink help..

Is it still showing the same error though?

400 - {“status”:{“error”:“Format error in JSON body: Expected some form of vector, id, or a type of query at line 1 column 13012”},“time”:0}

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