# Split string coming from API

**URL:** <https://discourse.nodered.org/t/split-string-coming-from-api/10756>\
**Category:** General\
**Created:** [2 May 2019 22:49 UTC](https://discourse.nodered.org/t/split-string-coming-from-api/10756 "2019-05-02T22:49:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nksky](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nksky/32/9173_2.png) [@nksky](https://discourse.nodered.org/u/nksky)\
**Post date:** [2 May 2019 22:49 UTC](https://discourse.nodered.org/t/split-string-coming-from-api/10756/1 "2019-05-02T22:49:48Z")

</div>

I need to split this string coming in from an API, I have tried, "Split" Node and "Switch" and tried the function node with "phrase", can anyone shed some light... Thanks in advance...  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/c/c5c9fb3b0923f0bf200e99b3513bad1a76f3625e.png)

Just want to extract "ts" and "value" individually.

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [2 May 2019 23:20 UTC](https://discourse.nodered.org/t/split-string-coming-from-api/10756/2 "2019-05-02T23:20:24Z")

</div>

The payload shown is typical of a JSON string. Try using a JSON node configured to "Always convert to JavaScript object" and then you can get the data you want in `msg.payload.temperature[0].ts` and `msg.payload.temperature[0].value`

---

<div class="post-metadata">

**Author:** ![nksky](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nksky/32/9173_2.png) [@nksky](https://discourse.nodered.org/u/nksky)\
**Post date:** [3 May 2019 06:30 UTC](https://discourse.nodered.org/t/split-string-coming-from-api/10756/3 "2019-05-03T06:30:40Z")

</div>

Perfect, thank you very much, I`m still getting confused with brackets etc,[0] I had left out this time. Once again thank you.

---

<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:** [3 May 2019 06:40 UTC](https://discourse.nodered.org/t/split-string-coming-from-api/10756/4 "2019-05-03T06:40:38Z")

</div>

This page explains how to use the debug panels tool tips to find and copy the path to any bit of data

[https://nodered.org/docs/user-guide/messages](https://nodered.org/docs/user-guide/messages)
