How would one show all of the key/values for http_request.query?
How would one show all of the key/values for http_request.query?
Re: dump all object keys/values
By: Mortifis to All on Wed Apr 08 2020 01:42 am
How would one show all of the key/values for http_request.query?
To print out the key/values of an object, I usually like to do this (this example assumes it's being run on the telnet terminal:
for (var prop in http_request.query)
console.print(prop + ": " + http_request.query[prop] + "\r\n"); console.pause();
To print out the key/values of an object, I usually like to do this
(this example assumes it's being run on the telnet terminal:
for (var prop in http_request.query)
console.print(prop + ": " + http_request.query[prop] + "\r\n");
console.pause();
JSON.stringify() does seem easier though:
console.print(lfexpand(JSON.stringify(http_request.query, null, 4)));
function dump_objs(obj)
{
Object.keys(obj).forEach(function (e) {
writeln(e + ': ' + JSON.stringify(obj[e]) + '<br>'); // run via an xjs script for html output
});
}
// and a possible call:
dump_objs(http_request.query);
Sysop: | deepend |
---|---|
Location: | Calgary, Alberta |
Users: | 272 |
Nodes: | 10 (0 / 10) |
Uptime: | 40:54:11 |
Calls: | 2,240 |
Calls today: | 1 |
Files: | 4,743 |
D/L today: |
19 files (9,997K bytes) |
Messages: | 422,778 |