Convert object in array

Hi Friends!

I am receiving a message that I configured on my mikrotik but I am not able to work on the arguments to separate the information such as link, operator and status.
I have tried with the flow jsonata, change and through function using "Object" and "valuesToArray" but I was not successful.

Below is a print and the code of my flow:

[{"id":"23cba95.bb3a756","type":"debug","z":"c109e6a1.40a078","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":890,"y":140,"wires":[]},{"id":"c5de5e56.8021e","type":"http in","z":"c109e6a1.40a078","name":"RB_POST","url":"/pmkt","method":"post","upload":false,"swaggerDoc":"","x":550,"y":140,"wires":[["6ba8477b.48d418","b8203ea9.27803"]]},{"id":"6ba8477b.48d418","type":"function","z":"c109e6a1.40a078","name":"convert","func":"var stat = \"\";\nstat = msg.payload.mensagem;\nmsg.payload = stat;\nreturn msg;","outputs":1,"noerr":0,"x":720,"y":140,"wires":[["23cba95.bb3a756"]]},{"id":"b8203ea9.27803","type":"http response","z":"c109e6a1.40a078","name":"","statusCode":"","headers":{"content-type":"application/json"},"x":570,"y":80,"wires":[]}]

I appreciate if you can help me solve this case!

In time, the output follows when I try to use the "msg.payload = Object.values (stat);"

You can pass it through a json node to convert the json string to an object.

But I have to ask what does the url look like as if you send http://ip:1880/pmkt?link=wan_1&operadora=vivo&status=down you should get the object not a json string

Thanks @ E1cid!

I will try this way, because as I am following a step by step of mikrotik I used the format 'http-data'.
I'm going to do a test right now and then return the result.

Unfortunately it does not work in Mikrotik create query via url ...
You can't even type in the "?" to start building the query.

This was the Mikrotik documentation that I followed:
Mikrotik Tools/Fetch URL

Ok, but did you try the first suggestion, passing the payload through a json node?

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