How to get the value from a json string

How can I extract this value from the json string marked in red?
It should not be in json format, but in a format like this:
[xxxx, xxxx, xxxx, xxxx]

… so I can use it to query a vector data base.

When I try parse json it’s giving me all the values in the collection one by one like this:

  1. xxxx
  2. xxxx
  3. xxxx

Welcome to the Make community!

You can either use a “Parse JSON” module,

or since it is in text format, you could possibly use the Text Parser “Match Pattern” module.

2 Likes


Thank you! I tried creating a regex pattern using chatgpt but its not work. The problem is that the json string value is a vector containing 1536 items (see screenshot)
This is the json string of my last module : [{“embedding”:[-0.013178274,0.0017673987,0.002196379,-0.042305253…]}]

And this is the regex pattern gpt gave me: “embedding”:[\s*(?:[-+]?\d*.?\d+(?:[eE][-+]?\d+)?(?:,\s*[-+]?\d*.?\d+(?:[eE][-+]?\d+)?){1535}[-+]?\d*.?\d+(?:[eE][-+]?\d+)?(?:,\s*[-+]?\d*.?\d+(?:[eE][-+]?\d+)?)\s]

I’m getting this error: Failed to refresh metadata. Invalid regular expression: /“embedding”:[\s*(?:[-+]?\d*.?\d+(?:[eE][-+]?\d+)?(?:,\s*[-+]?\d*.?\d+(?:[eE][-+]?\d+)?){1535}[-+]?\d*.?\d+(?:[eE][-+]?\d+)?(?:,\s*[-+]?\d*.?\d+(?:[eE][-+]?\d+)?)\s]/: Unterminated group

I think you are overly complicating things by using the wrong aggregators here.

Delete the Array Aggregator and JSON Aggregator.

Use “Text Aggregator” module (separate the items by comma)

Wherever you need to map the output variable, insert an additional pair of square brackets around the variable.

[ {{1.text}} ]
2 Likes

Thank you! I really was overcomplicating haha

2 Likes