# Split string into objects

**URL:** <https://discourse.nodered.org/t/split-string-into-objects/8212>\
**Category:** General\
**Created:** [21 February 2019 09:06 UTC](https://discourse.nodered.org/t/split-string-into-objects/8212 "2019-02-21T09:06:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![seppelicous](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/seppelicous/32/28408_2.png) [@seppelicous](https://discourse.nodered.org/u/seppelicous)\
**Post date:** [21 February 2019 09:06 UTC](https://discourse.nodered.org/t/split-string-into-objects/8212/1 "2019-02-21T09:06:45Z")

</div>

![PNG-Bild](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/00952bad07ba521b71bbe6dc8cf9692c966b0c42.png) Hi,

I use a serialport Node to receive ascii messages from an rs232 power inverter.  
Everything works fine and I got informations in one payload string:

```auto
00.00.0000 01:21:40 3 124.9 0.23 29 236.2 0.12 28 23

```

Now I want to seperate each value into one payload object. Like payload.voltage, payload.power etc

My js knowledge is limited and I absolutely have no idea how to split this string.

I appreciate your help,  
Sebastian

---

<div class="post-metadata">

**Author:** ![moebius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/moebius/32/2872_2.png) [@moebius](https://discourse.nodered.org/u/moebius)\
**Post date:** [21 February 2019 09:16 UTC](https://discourse.nodered.org/t/split-string-into-objects/8212/2 "2019-02-21T09:16:33Z")

</div>

And you already entered "split" into the forum search and nothing came up...

---

<div class="post-metadata">

**Author:** ![seppelicous](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/seppelicous/32/28408_2.png) [@seppelicous](https://discourse.nodered.org/u/seppelicous)\
**Post date:** [21 February 2019 09:30 UTC](https://discourse.nodered.org/t/split-string-into-objects/8212/3 "2019-02-21T09:30:29Z")

</div>

Yes, i googled a lot. But the values are not separated by commas to tabs but spaces of Individual length.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [21 February 2019 09:40 UTC](https://discourse.nodered.org/t/split-string-into-objects/8212/4 "2019-02-21T09:40:28Z")

</div>

This should provide the answer

[https://www.google.com/search?client=safari&rls=en&ei=s3FuXIKTMsyp1fAP7feGmAQ&q=how+to+split+a+string+with+multiple+spaces+in+javascript](https://www.google.com/search?client=safari&rls=en&ei=s3FuXIKTMsyp1fAP7feGmAQ&q=how+to+split+a+string+with+multiple+spaces+in+javascript)

---

<div class="post-metadata">

**Author:** ![seppelicous](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/seppelicous/32/28408_2.png) [@seppelicous](https://discourse.nodered.org/u/seppelicous)\
**Post date:** [21 February 2019 09:50 UTC](https://discourse.nodered.org/t/split-string-into-objects/8212/5 "2019-02-21T09:50:41Z")

</div>

Awesome, I will give \s+/ a try  
Thank you!
