The order of columns returned by this GraphQL query might not be what you think

Hi fellow developers,

I ran into an issue with my app (and solved it :slight_smile:) and I though others might benefit from this information as well.

Take this query in the API Playground
I was expecting a result with an array of column values [{text obj}, {status obj}] as that is the order of the arguments.

However what I did got returned was an array [{status obj}, {text obj}] (see below) as the API returns things in the order they appear in the board, and not in the order of the arguments.

So, if you think your code can iterate through the items array and then rely on column_values[0] and column_values[1] you might want to rethink :slight_smile:. Also, make sure you test your app on your board after you jiggled around some columns.
The most easy way to make your code independent of the order of columns in your board is to make sure you always ask for one column at the time. A more challenging solutions to solve this phenomenon is to sort the array in the order you want it sorted.


Hey @basdebruin,

Great catch! As you mentioned this is a good thing to keep in mind depending on your code and what you’re expecting to receive as a response (like if you’re storing it in an array).

Depending on your code you might also be able to generate the array based on the column name you are looking for. This is an example in Python, but the code would specifically look into the ‘teams’ value from the API response:

parsed_json = (json.loads(jsonString))
team_list = []
for t in parsed_json ['data']['me']['teams']:
team_string = str(team_list)

Hope this helps - and thank you again for sharing!


Hi @dsilva

That absolutely helps in certain scenarios. In this case there is something more to it. What I get returned is an array of items (in this example just 1) where each entry in that array contains an array (column_values) that in its turn is an array of objects (id, value).

I don’t know how to get the value that belongs to a given id for each item in the items array (other then iterating though the column_values and check each id). Maybe this is because my moderate coding experience :slight_smile:. I found a “solution” by splitting my query into 2 queries (one for both columns). Does that makes sense?