Serializing a boolean array from query.valuelist

I’m using the following code to create a json file: config.aPortActive = ListToArray(valueList(getPorts.bActive));

This produces “aPortActive”:[“1”,“1”,“0”,“0”,“0”,“0”,“0”,“0”] which causes my arduino json parser to read as all 0’s because the quotes turn those values into strings rather than numbers. Is there an elegant way to force the serializer into treating this as an array of numbers rather than characters?

the Lucee docs for ValueList https://docs.lucee.org/reference/functions/valuelist.html suggest using QueryColumnData instead https://docs.lucee.org/reference/functions/querycolumndata.html

this is what you are after?

Yes, this fixed it. Thanks for the quick reply. I don’t care much for the (table, “columnName”) syntax, though. It’s inelegant compared to query.columnName.

1 Like

yeah, query.column.toArray() feels nicer, but it also doesn’t preserve type information (yet)
https://luceeserver.atlassian.net/browse/LDEV-2294

Agreed - that’s better. I look forward to using it.

Thanks for being so responsive. Is Lucee safe for commercial use? Load balanced on AWS for instance?

Lots of companies are! of course you need to properly load test your site.

Personally I’d recommend (depending on your project schedule) testing against the latest snapshot which will become a RC and then stable version in two or so months, just so you don’t encounter any bugs which have already been addressed.

Fixes are very rarely backported, which is why I have adopted this approach.

Lucee Snapshots are just like Chrome Canary builds, you get all the good new stuff, but there might be the occasional problem