-
Notifications
You must be signed in to change notification settings - Fork 688
Closed
Description
Problem:
Setting INTO JSON is returning a flattened JSON object.
Code (NodeJS v12.14):
const alasql = require('alasql');
const data = [
{
name: 'item1',
details: {
stock: 10,
purchased: 100
}
},
{
name: 'item2',
details: {
stock: 20,
purchased: 200
}
},
{
name: 'item3',
details: {
stock: 30,
purchased: 300
}
},
]
const res = alasql(`SELECT name, details->stock INTO JSON() FROM ? WHERE details->stock > 11`, [data]);
console.log(res);
Output:
[{"name":"item2","details->stock":20},{"name":"item3","details->stock":30}]
Expected Output (Formatted):
[{
"name": "item2",
"details": {
"stock": 20
}
}, {
"name": "item3",
"details": {
"stock": 30
}
}]
I did read: https://github.com/agershun/alasql/wiki/Json and nothing about options for JSON() like there is for CSV()
Copilot
Metadata
Metadata
Assignees
Labels
No labels