'How can a linq query be converted to JavaScript array containing only values?

I have a JavaScript grid library (it creates a table on the page) that accepts a JavaScript array as input, for rendering in the grid. I'm not certain, however, how to convert a Linq-to-SQL query (against a SQL Server database) to a JavaScript array containing only values.

I tried this, but it included the table column names in the JSON key (and I don't want JSON anyway, I want a JavaScript string array, unless this can be converted to an array?):

JsonConvert.SerializeObject(query)

Example of the format I need to produce:

[1,2,3],[4,5,6]

Environment: .NET Core 3.1

edit: Here is a sample of what I've currently got, this returns the less than desirable JSON (due to the query results being so large, having a JSON key for very element is going to literally double the size of the query):

Devices Table

ID   Name
1    iPhone7
2    iPhone8
3    iPhone9

Needed Array (Note: no column names)

[1, "iPhone7"],[2, "iPhone8"],[3, "iPhone9"]

Current C# code in the controller method (returns undesirable key for every element currently)

var query = db.Devices;
var formattedResult = JsonConvert.SerializeObject(query);
return Ok(formattedResult);


Solution 1:[1]

Did you try

var query = db.Devices.ToList(); 
var array = JArray.FromObject(query);
return Ok(formattedResult)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1