Is it possible to not include the type in arrays through the API? We are using Go to get data through the API and when the array returns [“L”, 500, 600] we have a super hard time processing because of mixed types. Can we just return the array without that “L”?
Generally, Grist represents non-primitive types as
[TYPE_CODE_LETTER, arguments...], and values like
["L", 500, 600] are returned for lists, including Reference List columns.
I can see the possible difficulty with the types, but I don’t know if it makes sense to add an API option for which format such things are returned in (changing the default would mess with people already using the current API).
Here are some alternatives using Grist column types and formulas:
If you add a formula column of type
Anyand return a Reference List value (e.g. just
Table1.lookupRecords(...)), then it shows up in the API as
So looking up the third element of the returned array will be the array of numbers you want.
You can stringify the list into JSON in a formula, e.g.
import json json.dumps($RefListColumn.id)
Then the API will return a valid JSON string like
"[500, 600]", which you’d need to decode as JSON to get the array.
I’ll look into those other options, thanks!