Pass array of objects from Array Aggregator into Anthropic Claude API user message content

:bullseye: What is your goal?

I’m calling the Anthropic Claude API via Make’s HTTP module. I need to pass an array of objects (about 5 Google Places API candidates) into the Claude API’s user message content as part of the prompt text.

The Anthropic Messages API only accepts these top-level fields: model, max_tokens, tools, tool_choice, messages, system. The candidates have to live inside messages[1].content as text, not as a separate top-level field.

I need the user message content to look like this when sent to Claude:

Here is intake data and a list of candidates: [{“place_id”:“abc”,“name”:“Hill”,“formatted_address”:“804 Nicholas Pkwy”},{“place_id”:“def”,“name”:“Cape Coral Tax”}]
Pick the matching candidate.

What is the correct Make pattern to serialize an array of collections (from an Array Aggregator) into a clean JSON string that can be embedded inside another module’s text field?

:thinking: What is the problem & what have you tried?

My scenario flow:

  1. HTTP module calls Google Places API findplacefromtext, returns a candidates array of collections
  2. Iterator module walks each candidate
  3. Array Aggregator combines them back into an array with fields: place_id, name, formatted_address, rating
  4. JSON > Create JSON module builds the Claude API request body
  5. HTTP module sends the body to https://api.anthropic.com/v1/messages

Approaches I’ve tried:

  1. Using toString(aggregator.array) inside the content string — returns literal text “[{object},{object},{object}]” with no actual data, just the word “object” repeated.

  2. Adding “candidates” as a separate top-level field in the JSON Create module — Anthropic API rejects with error: “candidates: Extra inputs are not permitted”

  3. Using {{json(55.array)}} — error: “Function ‘json’ not found”

  4. Referencing the aggregator array directly inside the content string — produces invalid JSON, Claude API rejects the body.

I’m running in Make Cloud (not Workfront Fusion). I need the production-quality pattern, not a workaround.

:clipboard: Error messages or input/output bundles

Error from Claude API when candidates is a top-level field:
{“type”:“error”,“error”:{“type”:“invalid_request_error”,“message”:“candidates: Extra inputs are not permitted”}}

Error from Make when using {{json(55.array)}}:
Failed to map ‘0.content’: Function ‘json’ not found!

Error from toString approach — the body sent to Claude:
“content”: “…PLACES API CANDIDATES (JSON):\n[{object},{object},{object},{object},{object}]\n…”

Hello,

Have you tried the Text Aggregator?

You iterate through your array of candidates, generate aggregated text, and pass it directly to Claude.

Keep in mind that Claude expects the user message as a single parameter – so any JSON inside the prompt must be properly escaped. Otherwise, you’ll get constant errors.

PS. Curiosity. Why are you making a direct HTTP call to the Anthropic API instead of using the native Make.com modules?

Have a nice day,
Michal

Subject: RE: Pass array of objects from Array Aggregator into Anthropic Claude API user message content

Michal,

Thank you — the Text Aggregator was the answer. Posting back what worked in case anyone else hits this same wall.

Final architecture:

  1. HTTP module calls Google Places API findplacefromtext, returns the candidates array

  2. Iterator walks each candidate

  3. Text Aggregator (under Tools — searchable by name but not visible in my menu until I searched for it) builds a single-line formatted text string per candidate, pipe-separated, with Row Separator set to newline

  4. HTTP module sends the body to api.anthropic.com/v1/messages with the Text Aggregator’s output dropped directly into the user message content field as a {{NN.text}} reference

The one gotcha that bit me first: when I built the Text field in the Text Aggregator with newlines between each field (Candidate, Address, Place ID, Rating on separate lines), the resulting multi-line text broke the JSON body — exactly the escaping problem you warned me about. The fix was to format each candidate on a single line with pipe delimiters separating the fields, then let the Row Separator put a newline between candidates. That keeps the body valid JSON while still being readable to Claude.

Result: Claude returned match_confidence: high and the correct matched_place_id on the first clean test. Audit chain ran end-to-end through 15 downstream modules and produced a real client-ready report.

To your curiosity question — you’re right, the native Anthropic Claude module would be cleaner. The HTTP pattern got baked in early when the native module wasn’t available or robust enough for the use case, and we replicated it by cloning scenarios. Migrating to the native module is now on the cleanup list.

Really appreciate you taking the time to answer. Saved me from going down a Python-on-Render workaround path that would have added a dependency we didn’t need.

-– Ken