nodered
*Node-REDメモ [[index]] [[node]] #contents **バイナリ処理 バイナリ配列を作成 >msg.payload = new Buffer([0, 1, 2, 3, 4, 5]); >return msg; バイナリ配列から変数 >let buf = new Buffer([0x12, 0x34,0x56,0x78]); >let x = buf.readUint16BE(0); >let y = buf.readUint16BE(2); >msg.payload = x; >return msg; **JSON ***オブジェクトからJSONへの変換 >let x = 1; >let y = 2; >console.log(JSON.stringify({ x, y })); >console.log(JSON.stringify({ x: 5, y: 6 })); 結果 > '{"x":1,"y":2}' > '{"x":5,"y":6}' [[https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify]] end.
2025-10-10 14:50:34 32400