# Getting Data from a String

**URL:** <https://discourse.nodered.org/t/getting-data-from-a-string/11072>\
**Category:** General\
**Created:** [13 May 2019 13:50 UTC](https://discourse.nodered.org/t/getting-data-from-a-string/11072 "2019-05-13T13:50:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![llamedos](https://avatars.discourse-cdn.com/v4/letter/l/f17d59/32.png) [@llamedos](https://discourse.nodered.org/u/llamedos)\
**Post date:** [13 May 2019 13:50 UTC](https://discourse.nodered.org/t/getting-data-from-a-string/11072/1 "2019-05-13T13:50:39Z")

</div>

I need some help! I am not a developer but I have used node red for a solar monitor and it is working great. I have purchased a WiFi temperature monitor that has an API, which it is giving me in a string format (See Below). I want to take the Field8 Value which is 40 and put it in a gauge and I dont have any idea where to start!

Any help would be hugely appreciated.

"{"field3":{"value":0,"created\_at":"2019-05-09T21:59:05Z","net":"0"},"field1":{"value":24.081406,"created\_at":"2019-05-13T13:44:16Z"},"field2":{"value":31,"created\_at":"2019-05-13T13:44:16Z"},"field4":{"value":3.114682,"created\_at":"2019-05-13T12:59:04Z"},"field5":{"value":-35,"created\_at":"2019-05-13T13:44:14Z"},"field8":{"value":40,"created\_at":"2019-05-13T13:44:11Z","net":"1"}}"

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [13 May 2019 14:20 UTC](https://discourse.nodered.org/t/getting-data-from-a-string/11072/2 "2019-05-13T14:20:23Z")

</div>

See this recent thread... [Access a value on message](https://discourse.nodered.org/t/access-a-value-on-message/10925/)  
(including the bits at the end)

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [13 May 2019 14:25 UTC](https://discourse.nodered.org/t/getting-data-from-a-string/11072/3 "2019-05-13T14:25:41Z")

</div>

If the data type being returned is a JSON string (as it appears in your post), you should pass it to the `json` node, set to output a JS Object. Then I would wire this to a `change` node, and use the JSONata expression `payload.field8.value` to extract just that number 40.

The `change` node's JSONata expression editor even has a built-in "tester" panel, so you can take your actual data, paste it into the lower-left window as the **payload** value, and see the results of your expression in the lower-right window as you type the expression:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/a/ad7fa14dffb003579f5f417cf909c23b563c45a3.png)

_Note that the correct option for entering JSONata expressions is the `J:` pulldown, not `{}`_

---

<div class="post-metadata">

**Author:** ![llamedos](https://avatars.discourse-cdn.com/v4/letter/l/f17d59/32.png) [@llamedos](https://discourse.nodered.org/u/llamedos)\
**Post date:** [14 May 2019 10:40 UTC](https://discourse.nodered.org/t/getting-data-from-a-string/11072/4 "2019-05-14T10:40:30Z")

</div>

Perfect that worked a treat thank you.
