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: | Eric Oulashin |
---|---|
Location: | Beaverton, Oregon, USA |
Users: | 85 |
Nodes: | 16 (0 / 16) |
Uptime: | 07:34:43 |
Calls: | 6,744 |
Calls today: | 5 |
Files: | 8,536 |
D/L today: |
1,098 files (415M bytes) |
Messages: | 361,797 |
Posted today: | 8 |