# How to extract exact data from payload

**URL:** <https://discourse.nodered.org/t/how-to-extract-exact-data-from-payload/75659>\
**Category:** General\
**Created:** [23 February 2023 22:10 UTC](https://discourse.nodered.org/t/how-to-extract-exact-data-from-payload/75659 "2023-02-23T22:10:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![demokedes](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/demokedes/32/19082_2.png) [@demokedes](https://discourse.nodered.org/u/demokedes)\
**Post date:** [23 February 2023 22:10 UTC](https://discourse.nodered.org/t/how-to-extract-exact-data-from-payload/75659/1 "2023-02-23T22:10:22Z")

</div>

Dear all,  
I am getting GPS coordinated as a string. Please take a look at bellow screen.  
How can I get each value separately. Can I "call" latitude and longitude desperately?  
I tried with "payload.payload.value[0]", but it is giving me back only first character. If nothing else, can I call the first 17 characters?  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/c/7cba39c07d3fc2816f31899a82d6371552dc83ee.png)

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [23 February 2023 23:00 UTC](https://discourse.nodered.org/t/how-to-extract-exact-data-from-payload/75659/2 "2023-02-23T23:00:39Z")

</div>

Use a split node to split msg.payload.payload.value "split using ," and a join node set to Manual and to create an array.

This will a produce message with latitude as msg.payload[0] and longitude as msg.payload[1]

Note, latitude and longitude remain as strings, not numbers.

![Untitled 1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/b/4bb2b2782c6032ce95ab9986e4d3d2f759626ccc.jpeg)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [23 February 2023 23:33 UTC](https://discourse.nodered.org/t/how-to-extract-exact-data-from-payload/75659/3 "2023-02-23T23:33:43Z")

</div>

You can also pass it through a csv node, where you can name the lat an lon property and parse the numeric values too.

```auto
[{"id":"989e880ce2cf99af","type":"inject","z":"452103ea51141731","name":"","props":[{"p":"payload.payload.value","v":"1.2,20.4,0.0}","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":4720,"wires":[["24733675e0bd9f66"]]},{"id":"24733675e0bd9f66","type":"change","z":"452103ea51141731","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":4720,"wires":[["26de37f379ce117a"]]},{"id":"26de37f379ce117a","type":"csv","z":"452103ea51141731","name":"","sep":",","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"lat,lon","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":450,"y":4720,"wires":[["79a6e7d13e9387bf"]]},{"id":"79a6e7d13e9387bf","type":"debug","z":"452103ea51141731","name":"debug 234","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":610,"y":4720,"wires":[]}]

```

 ![chrome_screenshot_1677195295055](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/4/240ebccd2c05a80f2be6208fca568f3cf0c34259.png)

---

<div class="post-metadata">

**Author:** ![demokedes](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/demokedes/32/19082_2.png) [@demokedes](https://discourse.nodered.org/u/demokedes)\
**Post date:** [24 February 2023 22:08 UTC](https://discourse.nodered.org/t/how-to-extract-exact-data-from-payload/75659/4 "2023-02-24T22:08:51Z")

</div>

E1cid thank you very much. It is doing exactly what I was looking for.  
Regards,Rok

---

<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:** [10 March 2023 22:09 UTC](https://discourse.nodered.org/t/how-to-extract-exact-data-from-payload/75659/5 "2023-03-10T22:09:29Z")

</div>

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