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: | 102 |
Nodes: | 16 (0 / 16) |
Uptime: | 05:37:39 |
Calls: | 3,518 |
Calls today: | 6 |
Files: | 8,462 |
Messages: | 337,770 |
Posted today: | 1 |