# Hex array question

**URL:** <https://discourse.nodered.org/t/hex-array-question/56795>\
**Category:** General\
**Created:** [17 January 2022 12:22 UTC](https://discourse.nodered.org/t/hex-array-question/56795 "2022-01-17T12:22:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fsaavedra](https://avatars.discourse-cdn.com/v4/letter/f/a183cd/32.png) [@fsaavedra](https://discourse.nodered.org/u/fsaavedra)\
**Post date:** [17 January 2022 12:22 UTC](https://discourse.nodered.org/t/hex-array-question/56795/1 "2022-01-17T12:22:52Z")

</div>

I have a data string that comes from a Modbus module that is ([0x6F, 0x03, 0x01, 0x02, 0x03, 0x01, 0x8C, 0x84]), what I want is to take bytes 3 and 4 and join them like this:  
0x02 and 0x03 = 203 and transform those 203 from hexadecimal to decimal, which would be = 515.

In conclusion, what we need is to join those 2 bytes and then transform them to decimal.

Thank you.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [17 January 2022 13:27 UTC](https://discourse.nodered.org/t/hex-array-question/56795/2 "2022-01-17T13:27:29Z")

</div>

Node-red-contrib-buffer-parser is designed for this type of task.

Send your data array to a buffer-parser node, set an entry to read  
Type: int16be, offset 3, length 1.

You can convert as many parts of the byte array as required.

Edit: I assume this hex array is actually a buffer? you can confirm this by looking at the debug 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:** [18 March 2022 13:27 UTC](https://discourse.nodered.org/t/hex-array-question/56795/3 "2022-03-18T13:27:31Z")

</div>

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