Addressing an object within an array

Sorry for the basic question but I having some problems extrating my "count" as an integer from my payload when it comes back looking like this (result of an SQL query).


I tried with a function node and this code:

// Stores the result of the SQL query locally (is the connecting device registered?)
//var arrResult = msg.payload
var registered = msg.payload[0];
msg.payload = registered;
return msg;

However, I get the following on the debug console:



Sort you sql query out
SELECT count(*) AS myCount FROM table;
then you will get a friendly name format

or use msg.payload[0]["count(*)"]

1 Like

Perfect, thanks so much!