Split and Split Again

I am new to Node-Red so I hope that I can explain this in a way that makes sense. I am getting data from a program called Pira CZ that triggers when silence is on our station. It uses HTTP Get to input into Node Red and this is what it picks up.

{"0":"STATION:KXKX,STATUS:SILENT,DATE:2020-10-13,TIME:17-58-08"}

I can change the format if it makes sense. I then need to run it through a function node so that I can split it.

STATION:KDDB,STATUS:SILENT,DATE:2020-10-13,TIME:18-00-13

I then split it at the commas to give me four separate values:

STATION:KDDB
STATUS:SILENT
DATE:2020-10-13
TIME:18-01-53

Now, I want to Split these so that the left is the key and the right is the value. I feel like this could be all done in the function node but I lack that level of programming. I am still learning and no better way then to figure out what hasn't worked but I am stumped at this point. I want to be able to log this information as well as send to the UI. There is also a message that will tell us when the station is back to normal as well.
Aloha!

If you select return a json object in the http request, you will get key value pairs in a javasript object. no need for all the spliting

Change your return to
{"0":{"STATION":"KXKX","STATUS":"SILENT","DATE":"2020-10-13","TIME":"17-58-08"}]

or
[{"STATION":"KXKX","STATUS":"SILENT","DATE":"2020-10-13","TIME":"17-58-08"}]

If you can change the format, why don't you put each value in their own property?

I meant that I can send a single line formatted in different ways. I guess what I said is misleading or I am missing the approach you are suggesting?

JSON is a string. format the data as JSON then its a simple case of turning it into a JS object & accessing values like...

data.station
data.status
data.date
//etc

Question - do you generate this {"0":"STATION:KXKX,STATUS:SILENT,DATE:2020-10-13,TIME:17-58-08"} or do you only generate STATION:KXKX,STATUS:SILENT,DATE:2020-10-13,TIME:17-58-08 ?

I am producing the first one. I get what you are saying and apologize for my lack of knowledge on JSON. Still learning all this. Appreciate the patience.

Can you format it like this then?
{"STATION":"KXKX","STATUS":"SILENT","DATE":"2020-10-13","TIME":"17-58-08"}

I sure can. I was about to reply to your earlier message. I am doing it know. I take it at that point I insert into the JSON node and convert?

if you want to or you can set the http request to return a json object, it will then decode your json string into a javascript object.

I have and this is what I see on the other side of the HTTP GET Node in the DEBUG.

{"{"STATION":"KDDB","STATUS":"SILENT","DATE":"2020-10-14","TIME":"10-52-00"}":""}

you need to remove the {" from beginning and ":""} from end.

Or if not possible
try
{"0":{"STATION":"KXKX","STATUS":"SILENT","DATE":"2020-10-13","TIME":"17-58-08"}}

Or show us a screeshot of how you are editing this string.

OK. I have learned a little more on how this program is adding the {" and the ":""}. It seems I can stop this by adding this in front 0= So the line looks like this in the program at this point:

This is the output now in the debug window:
{"STATION":"KDDB","STATUS":"SILENT","DATE":"2020-10-14","TIME":"14-18-23"}

I feel like I am getting a little closer.

OK that looks correct, now in the http request node change return a UTF-8 string to parse json object.

Also a screen shot of the debug msg expanded.

Thanks. I had to step away for some other work.

Here is the screenshot:
Screen Shot 2020-10-17 at 12.21.18 PM

I am actually using the HTTP IN node since the program sends an HTTP Get. I know that if I use the JSON expression it allows me to parse the data. I think I have just run into a limitation on what the software can send in the GET request.

Ok we can work with it that way
Try this to convert to object and remove the object [0]

[{"id":"70884b11.0d3814","type":"inject","z":"8d22ae29.7df6d","name":"","props":[{"p":"payload[0]","v":"{\"STATION\":\"KXKX\",\"STATUS\":\"SILENT\",\"DATE\":\"2020-10-13\",\"TIME\":\"17-58-08\"}","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":70,"y":960,"wires":[["70d0c20b.aaab9c"]]},{"id":"70d0c20b.aaab9c","type":"change","z":"8d22ae29.7df6d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[0]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":260,"y":960,"wires":[["4d272653.0588f8"]]},{"id":"4d272653.0588f8","type":"json","z":"8d22ae29.7df6d","name":"","property":"payload","action":"obj","pretty":false,"x":450,"y":960,"wires":[["2f916e88.bb5672"]]},{"id":"2f916e88.bb5672","type":"debug","z":"8d22ae29.7df6d","name":"success","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":610,"y":960,"wires":[]}]

I was thinking what happens if you structure your Pira CZ call like this

STATION=KXKX&STATUS=SILENT&DATE=%date&TIME=%time

So Simple and so right. This did the trick. It formatted perfectly.

Yeah should have spotted it earlier. It was when you said that the software was making a get request, a idea popped in to my head.