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: | Ragnarok |
---|---|
Location: | Dock Sud, Bs As, Argentina |
Users: | 136 |
Nodes: | 10 (0 / 10) |
Uptime: | 10:04:18 |
Calls: | 15,171 |
Calls today: | 4 |
Files: | 19,857 |
D/L today: |
27 files (1,201K bytes) |
Messages: | 1,691,557 |