Dash (-) in array data

hi everyone, i have a problem with array.
in my data i have somthing like this in my array:

array[1]
0: object
name: "ether5"
rx-packets-per-second: "2"
rx-bits-per-second: "1200"
fp-rx-packets-per-second: "2"
fp-rx-bits-per-second: "992"
rx-drops-per-second: "0"
rx-errors-per-second: "0"
tx-packets-per-second: "1"
tx-bits-per-second: "2768"
fp-tx-packets-per-second: "1"
fp-tx-bits-per-second: "2736"
tx-drops-per-second: "0"
tx-queue-drops-per-second: "0"
tx-errors-per-second: "0"

as you can see betwhen all words i have dash - exepct "name"
so for example when i used:
msg.payload = msg.payload [0].fp-rx-packets-per-second;
debug say:
"ReferenceError: rx is not defined (line 1, col 34)"
how can i fix it ?

use the alternative syntax

msg.payload [0]["fp-rx-packets-per-second"];

put the variable name in quotes in square braces with no dot

1 Like

you are the best.
that was so fast.
problem solved :rofl
thank you
i dont know what say