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: | 281 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 15:39:46 |
| Calls: | 2,401 |
| Files: | 5,162 |
| D/L today: |
59 files (23,533K bytes) |
| Messages: | 437,256 |