Graphql Query Arguments

How to pass list as an argument to Graphql query from postman?

I need to pass string array to Graphql query like this:

      metrics(brandName: ["abc", "xyz"]){

But this error occurs “Expected string found [“abc”, “xyz”]”. How can I resolve this? Is there any other syntax to pass array to Graphql query?

Hi @mariam_khan

You could use JSON.stringify() to turn the array into a string before passing it to the GraphQL body.

For example;

const myArray = ["abc", "xyz"];


let arrayAsString = JSON.stringify(myArray);



Hello @w4dd325

Although the problem “Expected string found [“abc”, “xyz”]” has been resolved now but still unable to pass list as an argument to graphql query.

I’m using Graphql with Golang and need to take list as an argument for further query processing. For example, want to get orders and customers for each brand in the list.

If I convert it to string the calculations become little more complicated. Therefore we are looking for a suitable approach to pass list to graphql query.

But when I send the request from postman, brandName is set as empty list.