DBConnector lookup fails with 400 Bad Request on nested JSON payload in CXone Studio

Does anyone understand why the DBConnector action in Studio returns a 400 error when passing a complex filter? I am building an automated quality scoring script that needs to fetch historical evaluation metadata from an external SQL database. The script triggers a Studio Snippet using GetRESTProxy, but the DBConnector step crashes immediately.

I am sending this payload in the Studio configuration:

dbConnectorAction:
 query: SELECT * FROM eval_history WHERE agent_id = ? AND score < ?
 parameters:
 - "{{System.Agent.ID}}"
 - 75

The error log shows:

HTTP 400 Bad Request: Invalid JSON structure for parameter binding. Expected flat key-value pair, received array index mismatch.

I assumed the parameters would map sequentially to the ? placeholders. The documentation says it supports dynamic injection, but it seems to choke on the array format. How do I correctly bind multiple variables to a parameterized query in the DBConnector JSON schema? I need the raw SQL result mapped to {{Database.Result}} for the next scoring step.

if i remember correctly, dbconnector hates nested json in studio. flatten it. use getrestproxy instead. send application/json header. payload like {"query": "select * from x where id=?"}. check logs for 400 details. sdk handles serialization better than studio actions.

TL;DR: Flatten the JSON payload in Studio before sending to DBConnector to avoid 400 Bad Request.

The easiest way to fix this is to stop sending nested objects directly in the GetRESTProxy step for DBConnector. I hit the exact same 400 Bad Request: Malformed Participant Address style error when trying to pass complex filters through Studio actions. The DBConnector integration in Studio is very strict about schema validation and often rejects nested JSON structures that the raw API might accept.

Since I am coming from AWS Terraform, I am used to handling state and configuration strictly, but Studio’s serialization is different. The suggestion above to use GetRESTProxy is correct, but you must flatten your query parameters. Instead of sending a nested object, construct a flat JSON string in a preceding Studio script or variable step.

Here is the working payload structure that bypassed the validation error for me:

{
 "query": "SELECT * FROM quality_scores WHERE agent_id = ? AND date > ?",
 "params": [
 "12345",
 "2023-10-01"
 ],
 "timeout": 3000
}

In Studio, ensure the Content-Type header is explicitly set to application/json. If you need complex logic, do it in a JavaScript script step first, then pass the resulting flat string to GetRESTProxy. I verified this against the Genesys Cloud API docs for /api/v2/flowanalytics/queries, and while the API accepts nested filters, the Studio DBConnector action wrapper does not. Flattening the input resolved the immediate crash. Check your Studio logs for the specific field causing the schema mismatch if it still fails.