# Binary values in inject node

**URL:** <https://discourse.nodered.org/t/binary-values-in-inject-node/97986>\
**Category:** General\
**Created:** [5 July 2025 17:08 UTC](https://discourse.nodered.org/t/binary-values-in-inject-node/97986 "2025-07-05T17:08:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [5 July 2025 17:08 UTC](https://discourse.nodered.org/t/binary-values-in-inject-node/97986/1 "2025-07-05T17:08:41Z")

</div>

Hi There,

I'm just playing around with @cymplecy [inhouse mqtt broker](https://discourse.nodered.org/t/fun-exercise-make-an-mqtt-broker-in-node-red/82229) and came across the switch at the front which contains binary and hexadecimal values in a number field:

 ![Screenshot 2025-07-05 at 19.03.57](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/6/166e1d138690ed4a178e2aefe0caafcd916a7cb2.png)

When I use an inject node to generate those values, I get a format error:

 ![Screenshot 2025-07-05 at 18.58.36](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/0/20031910945d07cf631a4cd4f519ba177ac24381.png)

but no errors on the edit panel:

 ![Screenshot 2025-07-05 at 19.05.16](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/9/199070b242722e204e9616b63ac7fd068344b6bd.png)

I tried using the buffer type for those values but got a JSON parse error:

 ![Screenshot 2025-07-05 at 19.06.12](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/7/37e369239691604e9fe4b887c9169a68f5dcfbb2.png)

How is that the number field in the switch node supports a different set of values to the inject node - what am I missing?

The nodes in questoin:

```flows
[{"id":"ce8a0e2105861dc1","type":"inject","z":"dc897f402c53697f","name":"","props":[{"p":"fuar","v":"0b00110000","vt":"num"},{"p":"ff","v":"0x82","vt":"num"},{"p":"gg","v":"0xC0","vt":"num"},{"p":"hh","v":"0b10100010","vt":"num"},{"p":"jjj","v":"0b11100000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":848,"y":1133,"wires":[["943d8187afdbd94d"]]},{"id":"f3500f36eed92063","type":"switch","z":"dc897f402c53697f","name":"Test packet type","property":"payload.0","propertyType":"msg","rules":[{"t":"eq","v":"16","vt":"num"},{"t":"eq","v":"0xC0","vt":"num"},{"t":"gte","v":"0b00110000","vt":"num"},{"t":"eq","v":"0x82","vt":"num"},{"t":"eq","v":"0b10100010","vt":"num"},{"t":"eq","v":"0b11100000","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":7,"x":903,"y":1255,"wires":[[],[],[],[],[],[],[]]},{"id":"943d8187afdbd94d","type":"debug","z":"dc897f402c53697f","name":"debug 437","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1142,"y":1157,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [5 July 2025 21:10 UTC](https://discourse.nodered.org/t/binary-values-in-inject-node/97986/2 "2025-07-05T21:10:28Z")

</div>

Please raise an issue if something valid is being flagged as an error

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [6 July 2025 07:32 UTC](https://discourse.nodered.org/t/binary-values-in-inject-node/97986/3 "2025-07-06T07:32:52Z")

</div>

> [@knolleary](#):
>
> raise an issue if something valid

> <https://github.com/node-red/node-red/issues/5208>
>
> \### Current Behavior
> 
> See \[forum\](https://discourse.nodered.org/t/binary-values-…in-inject-node/97986) for more details
> 
> The inject node shows a red triangle of invalidness even though the edit panel shows no error:
> 
> \<img width="577" height="265" alt="Image" src="https://github.com/user-attachments/assets/0bfed8b8-b90e-41a0-8c18-f7972ab4f962" /\>
> 
> which shows:
> 
> \<img width="404" height="143" alt="Image" src="https://github.com/user-attachments/assets/614ed460-1b65-4ac1-9232-650551d36c65" /\>
> 
> Meanwhile the switch node happily supports both values for a number field:
> 
> \<img width="495" height="312" alt="Image" src="https://github.com/user-attachments/assets/e1be6aa2-b628-4132-aeac-99b21bc61bb5" /\>
> 
> and on the workspace:
> 
> \<img width="231" height="101" alt="Image" src="https://github.com/user-attachments/assets/5c9f6623-4ba2-4a79-b00c-762b5082ef30" /\>
> 
> \### Expected Behavior
> 
> It should either accept the values or show a warning in the edit panel - for the inject node.
> 
> The behaviour of the switch node should not change!
> 
> \### Steps To Reproduce
> 
> 1. create inject node
> 2. select a number value
> 3. type '0b0000100100100110' as value
> 4. add value, select number type
> 5. type '0xfeed60d'
> 6. close inject edit panel with "Done"
> 7. invalid red triangle is shown for node
> 
> Note: inside the edit panel there was no warning of invalidity
> 
> do the same with the switch node and there is no invalid warning, either in the edit panel nor on the workspace.
> 
> \### Example flow
> 
> \`\`\`
> \[{"id":"300469b5b5c8f7c7","type":"inject","z":"dc897f402c53697f","name":"","props":\[{"p":"binary","v":"0b00110000","vt":"num"},{"p":"hex","v":"0x82","vt":"num"},{"p":"startX","v":"x112","vt":"num"},{"p":"startB","v":"b01011","vt":"num"}\],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":714,"y":1339,"wires":\[\["6de799c62eaf1828"\]\]},{"id":"1f1528e94b50f003","type":"switch","z":"dc897f402c53697f","name":"Test packet type","property":"payload.0","propertyType":"msg","rules":\[{"t":"eq","v":"0xC0","vt":"num"},{"t":"gte","v":"0b00110000","vt":"num"},{"t":"else"}\],"checkall":"true","repair":false,"outputs":3,"x":708,"y":1436,"wires":\[\[\],\[\],\[\]\]},{"id":"6de799c62eaf1828","type":"debug","z":"dc897f402c53697f","name":"debug 437","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":928,"y":1399,"wires":\[\]},{"id":"be3f80a7435921d5","type":"inject","z":"dc897f402c53697f","name":"","props":\[{"p":"binary","v":"0b00110000","vt":"num"},{"p":"hex","v":"0x82","vt":"num"}\],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":714,"y":1279,"wires":\[\[\]\]}\]
> \`\`\`
> 
> 
> \### Environment
> 
> \- Node-RED version: 4.0.5 and tested with 4.1.0.beta2
> \- Node.js version: up to and including 22
> \- npm version: xxx
> \- Platform/OS: docker
> \- Browser: firefox

Done.

BTW you are going to support having binary and hexadecimal values in the inject node right? I mean you're not going to add an error in the edit panel?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [20 July 2025 07:33 UTC](https://discourse.nodered.org/t/binary-values-in-inject-node/97986/4 "2025-07-20T07:33:18Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
