Why? The http request node can be set to output a json object.
@Ryanshafer You don't say if you parse all the arrays or if you after a specific one.
here is an example of using Javascript and JSONata to map all the values to an array of objects.
[{"id":"88aeec8c.8e386","type":"inject","z":"9a86d59e88442f2c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"<?xml version=\"1.0\" encoding=\"utf-8\" ?> <!DOCTYPE data [ <!ELEMENT data (parameter+)> <!ELEMENT parameter (name,value)> <!ELEMENT name (#PCDATA)> <!ELEMENT value (#PCDATA)> ]> <data> <parameter> \t<name>DB_L2174_ALARMS</name> \t<value><![CDATA[0000000000000111000000000000000]]></value> </parameter> <parameter> \t<name>DB_DEMOD_LICENCE_OPTIONS</name> \t<value><![CDATA[1110010000000000000001000000000000000000]]></value> </parameter> <parameter> \t<name>DB_DECOD_LICENCE_OPTIONS</name> \t<value><![CDATA[0000000000000000000000000000000000000000]]></value> </parameter> <parameter> \t<name>DB_DEMOD_SELFTEST_RESULTS</name> \t<value><![CDATA[100000000000000000000000000000000]]></value> </parameter> <parameter> \t<name>DB_L2174_RX_MODE</name> \t<value><![CDATA[DVBT]]></value> </parameter> <parameter> \t<name>DB_L2174_FREQ1</name> \t<value><![CDATA[2.030000]]></value> </parameter> </data>","payloadType":"str","x":70,"y":300,"wires":[["e129cb3.1181238"]]},{"id":"e129cb3.1181238","type":"http request","z":"9a86d59e88442f2c","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://ssd-api.jpl.nasa.gov/cad.api?date-min=now&dist-max=0.2","tls":"","persist":false,"proxy":"","authType":"","x":240,"y":300,"wires":[["72662c0b.42bec4","df71d57e.fe9248"]]},{"id":"72662c0b.42bec4","type":"change","z":"9a86d59e88442f2c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$$.payload.data@$a.($$.payload.fields#$i.${$: $a[$i]})","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":400,"wires":[["995d7e86.aea2f"]]},{"id":"df71d57e.fe9248","type":"function","z":"9a86d59e88442f2c","name":"","func":"msg.payload = msg.payload.data.map(arr => {\n let obj = {};\n msg.payload.fields.forEach((key, index) => {\n obj[key] = arr[index];\n })\n return obj;\n})\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":450,"y":280,"wires":[["9e47108c.90d0f8"]]},{"id":"995d7e86.aea2f","type":"debug","z":"9a86d59e88442f2c","name":"jsonata","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":650,"y":400,"wires":[]},{"id":"9e47108c.90d0f8","type":"debug","z":"9a86d59e88442f2c","name":"javascript","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":630,"y":280,"wires":[]}]
Javascript
msg.payload = msg.payload.data.map(arr => {
let obj = {};
msg.payload.fields.forEach((key, index) => {
obj[key] = arr[index];
})
return obj;
})
return msg;
JSONata
$$.payload.data@$a.($$.payload.fields#$i.${$: $a[$i]})