Help me about payload

i've 2 same payloads in the same time like this

image

what i want is make first payload to payload.first and second payload to payload.second.
can someone help me ?

[{"id":"a8c021c4.dfc1c","type":"inject","z":"b9c42b46.292c88","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":160,"wires":[["a7e5c23f.8f465"]]},{"id":"a7e5c23f.8f465","type":"http request","z":"b9c42b46.292c88","name":"","method":"GET","ret":"obj","paytoqs":false,"url":"https://www.n2yo.com/rest/v1/satellite/tle/44048&apiKey=4LW4JM-WQ9W8J-YZJJE9-47FR","tls":"","proxy":"","authType":"","x":270,"y":160,"wires":[["65e01ad6.261d04"]]},{"id":"65e01ad6.261d04","type":"function","z":"b9c42b46.292c88","name":"","func":"msg.payload = msg.payload.tle;\n\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":160,"wires":[["f83b2e74.84f3d"]]},{"id":"f83b2e74.84f3d","type":"split","z":"b9c42b46.292c88","name":"","splt":"\\r\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":530,"y":160,"wires":[["83372a3e.556968"]]},{"id":"83372a3e.556968","type":"debug","z":"b9c42b46.292c88","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":720,"y":160,"wires":[]}]

Sorry for my bad english T_T

Can you copy and paste the text itself here?

i send the code. wait...

You have two different payloads and you want them both in the same message?

Take a look at this example in the cookbook
https://cookbook.nodered.org/basic/join-streams

which would get them into the same message
You can then use the change node to rename them

Try this

[{"id":"7032d07e.ac87e8","type":"inject","z":"d9b461a2.a6f6d8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":108,"y":264,"wires":[["760f593d.abdc38"]]},{"id":"760f593d.abdc38","type":"http request","z":"d9b461a2.a6f6d8","name":"","method":"GET","ret":"obj","paytoqs":false,"url":"https://www.n2yo.com/rest/v1/satellite/tle/44048&apiKey=4LW4JM-WQ9W8J-YZJJE9-47FR","tls":"","proxy":"","authType":"","x":258,"y":264,"wires":[["57b82f0e.7b88f"]]},{"id":"57b82f0e.7b88f","type":"function","z":"d9b461a2.a6f6d8","name":"","func":"m = msg.payload.tle;\n\no = m.split(\"\\n\")\n\nreturn {payload:{first:o[0],second:o[1]}}\n\n","outputs":1,"noerr":0,"x":410,"y":264,"wires":[["c03a07bb.cf637"]]},{"id":"c03a07bb.cf637","type":"debug","z":"d9b461a2.a6f6d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":554,"y":264,"wires":[]}]

note - your API key is in here, make sure to change it.

1 Like

my output is in msg.payload what i want is change it to msg.payload.first.

If you are using the change node, add an extra change before the others to turn the payload into an object. Then you can follow up with further changes to add the properties you want to the payload object. Alternatively, if you are comfortable with JavaScript, you can use a function node.