# Only print ending

**URL:** https://discourse.nodered.org/t/only-print-ending/77289
**Category:** General
**Tags:** function-node
**Created:** [5 April 2023 19:53 UTC](https://discourse.nodered.org/t/only-print-ending/77289 "2023-04-05T19:53:49Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![nbech](https://avatars.discourse-cdn.com/v4/letter/n/aca169/32.png) [@nbech](https://discourse.nodered.org/u/nbech)
#### Post date: [5 April 2023 19:53 UTC](https://discourse.nodered.org/t/only-print-ending/77289/1 "2023-04-05T19:53:49Z")

</div>

I have a payload sting thats exporting like this. Im wanting to read just the end fields and not all the " { :.

I have tired using the split but I cant seem to get the right function.

 ![Screenshot 2023-04-05 at 2.51.05 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/5/95d751d773a969f54b51672fc4a0edbf50174ad2.png)

 ![Screenshot 2023-04-05 at 2.49.48 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/3/13b99e7a613a28e75b01a5847e7630e61a95e65b.png)

node: debug 113  
msg.payload : string[51]  
"{"INDIANA _2_":"INDIANA _2_","TK3300KI":"TK3300KI"}"

The result Im looking for is INDIANA _2_ and TK3300KI instead of "{"INDIANA _2_":"INDIANA _2_","TK3300KI":"TK3300KI"}"

---

<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: [5 April 2023 20:06 UTC](https://discourse.nodered.org/t/only-print-ending/77289/2 "2023-04-05T20:06:32Z")

</div>

At your debug node "debug 104" the payload is an object.  
At node "false" msg.detect is an object  
And at "debug 113" payload is a string.

In what format does the data arrive in Node-red?

Can you explain why you have a key `"INDIANA *2*`" rather than (say) `"INDIANA"`?  
Do you have control over the format of this data?

It would be much easier for you if the data arrived in a format like

```auto
{
state: "INDIANA",
code: "TK3300KI"
}

```

---

<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: [5 April 2023 20:09 UTC](https://discourse.nodered.org/t/only-print-ending/77289/3 "2023-04-05T20:09:19Z")

</div>

If you keep payload as an object, here are two methods that do not use a function node.

```auto
[{"id":"0b5d0e8dc1368573","type":"inject","z":"65617ffeb779f51c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"INDIANA 2\":\"INDIANA 2\",\"TK3300KI\":\"TK3300KI\"}","payloadType":"json","x":90,"y":2540,"wires":[["5c49e57a0dbd2aec","230bdbe7d1b651b4"]]},{"id":"5c49e57a0dbd2aec","type":"split","z":"65617ffeb779f51c","name":"","splt":",","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":210,"y":2540,"wires":[["3ba3c6856406b414"]]},{"id":"230bdbe7d1b651b4","type":"csv","z":"65617ffeb779f51c","name":"","sep":",","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":230,"y":2580,"wires":[["3fc8ab1d7234c172"]]},{"id":"3ba3c6856406b414","type":"change","z":"65617ffeb779f51c","name":"","rules":[{"t":"set","p":"parts.type","pt":"msg","to":"string","tot":"str"},{"t":"set","p":"parts.ch","pt":"msg","to":" and ","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":2540,"wires":[["607a05e9264273bd"]]},{"id":"3fc8ab1d7234c172","type":"change","z":"65617ffeb779f51c","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":",","fromt":"str","to":" and ","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":2600,"wires":[["7f767c0cfe93dc5b"]]},{"id":"607a05e9264273bd","type":"join","z":"65617ffeb779f51c","name":"","mode":"auto","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":"false","timeout":"","count":"","reduceRight":false,"x":550,"y":2540,"wires":[["7f767c0cfe93dc5b"]]},{"id":"7f767c0cfe93dc5b","type":"debug","z":"65617ffeb779f51c","name":"debug 261","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":750,"y":2600,"wires":[]}]

```

---

<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: [19 April 2023 20:09 UTC](https://discourse.nodered.org/t/only-print-ending/77289/4 "2023-04-19T20:09:38Z")

</div>

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